On Thu, Feb 12, 2009 at 11:06 PM, Toadster <[email protected]> wrote:
> My immediate quandry is retrieving data entered by
> the user in the EditText fields of xml.
>
<snip>
>
> I have all the mechanics of this working except the regurgitation of
> the data entered. I have called the findViewById() and pulled the
> data from the xml file to the activity and assigned it to a String.
I think there's a problem here. When you findViewById for nameUser, you're
going to get an EditText back, not a string. Here's what I usually do:
EditText mynameUser = (EditText) findViewbyId(R.id.nameUser);
String Username = mynameUser.getText().toString();
and you will now have a string in Username.
Can't seem to get the Strings to output in the second activity called
> Preferences.
For that, you are going to have to put your data (Username, etc.) into a
Bundle and pass that into the Intent. Maybe something like this:
/* Create an Intent to start * MySecondActivity. */
Intent i = new Intent( LayoutTest1.this, Preferences.class);
i.putExtra("USERNAME", Username);
// repeat ad nauseum
startActivityForResult(i, 0x1337);
then in your other activity's onCreate(), you can do
Bundle extras = getIntent().getExtras();
String myUsername = extras.getString("USERNAME");
HTH
--
Faber Fedor
Linux New Jersey
http://linuxnj.com
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---