You're mixing a few things:
- the id of a view (i.e. R.id.calculate_id) is just that: an
identifier that lets you *find* the object in question.
- you can't assign to that id, it's just a constant integer
Instead you should do:
- find the view based on the id:
EditText myEditField = (EditText) findViewById(R.id.calculate_id);
- use some of the EditText methods to change the text:
http://developer.android.com/reference/android/widget/EditText.html
e.g:
myEditField.setText("42");
I *strongly* suggest you get an introductory book on Android or look
at some of the samples under SDK/platform-1.6/samples/
HTH
R/
On Wed, Sep 16, 2009 at 8:39 PM, Rc3375 <[email protected]> wrote:
>
> i have a file that was created in eclipse. the screen has been
> designed with one field that the user would enter a value such as
> 123.45, and the rest of the fields are calculated from the 123.45.
> all the EDITTEXT fields have their default values(public static final
> int calculate_id=0x7f050006).(from the R.java file. they are assigned
> a value from the calculation(R.id.calculate_id = xx;). all the
> values in the R.java file seem the default to public static final int
> calculate_id=xxxxxxxxxx. the R.id.calculate_id = XX fails. it does
> not matter if XX is an integer,double or float. is there a way to
> convert the R.id.calculate_id(EditText) field to either float or
> double? i have tried to parse it and cast it. but everytime that is
> done and you recompile the file, the R.java file will revert to the
> orginal settings. literally driving me nuts.......help
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---