6 messages in com.googlegroups.android-beginners[android-beginners] EditText to Strin...
FromSent OnAttachments
Kyle24 Apr 2008 17:24 
Dan U.24 Apr 2008 17:28 
Kyle24 Apr 2008 18:21 
Dan U.24 Apr 2008 18:36 
Kyle24 Apr 2008 18:50 
Dan U.24 Apr 2008 19:20 
Subject:[android-beginners] EditText to String to int
From:Kyle (xXKo@gmail.com)
Date:04/24/2008 05:24:01 PM
List:com.googlegroups.android-beginners

Hi, I've been looking for a way of doing this, maybe it's just my lack of thought, or maybe I'm just too noob at Java, but I'm trying to get EditText text (can do this), send to a string (can also do this) convert to int, add to a global int, and then write the global int to a TextView. Here is my code:

final int totalCost=0; btnAddCost.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { final String value = btnAddCost.getText().toString(); totalCost = Integer.parseInt(value); txtTotalCost.setText("$"+totalCost); } });

Eclipse returns an error saying: The final local variable totalCost cannot be assigned, since it is defined in an enclosing type

Any ideas? Basically what it is, is a price updater, adds the amount of money you typed in, to the TextView (txtTotalCost)