Hello all....new to this group and definitely an Android noob! Been studying though, so here goes. I am writing an application (or trying to) that will ultimately compile a browser URL history log file, and email to a specific address as a background task (Service???). All that comes later. My immediate quandry is retrieving data entered by the user in the EditText fields of xml.
Goal: Initial activity... show UI screen with multiple fields...user enters field info.....then clicks "Submit" button at the bottom of the screen. Then new activity is launched, showing the entered data with headers. 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. Can't seem to get the Strings to output in the second activity called Preferences. You will notice in the prefs.xml file that the android:text lines are only outputting quoted text at the moment. The reason is that all my attempts a placing the string id's here have failed, so the text are place holders for the moment. Also, not listed below, but I have declared the second activity in the manifest as per the "MySecondActivity" tutorial and it seems to work fine. Sorry for the insane length of this post......any help would be greatly appreciated. ***************main.xml*********************************************************** <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" padding="10" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> //Enter Username <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Please enter the required information." /> <EditText android:id="@+id/nameUser" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint = "Enter Owner's First and Last Name" /> // Enter Partner Name <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text=" " /> <EditText android:id="@+id/namePartner" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint = "Partner's First and Last Name" /> // Enter Partner Email Address <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text=" " /> <EditText android:id="@+id/emailPartner" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint = "Partner's Email Address" /> //Enter Partner Admin Password <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text=" " /> <EditText android:password="true" android:id="@+id/pswdAdmin" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint = "Enter Partner's Password" /> // Press Submit button and compile values to variables <Button android:id="@+id/btn_submit" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Submit" /> </LinearLayout> *********************************prefs.xml********************************** <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" padding="10" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text = "Username" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text = "Partner's Name: " /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text = "Partner's Email Address: {emailPartner}" /> </LinearLayout> **************************************LayoutTest1.java************************************* (first activity)****** package com.toadster.layouttrial1; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class LayoutTest1 extends Activity { /** Called when the activity is first created. */ //Declaring variables String Username = "Your Name"; String Partnername = "Partner's Name"; String Partneremail = "Email Address"; String Password = "Password"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /*Find the Button from our XML Layout */ Button b = (Button)this.findViewById(R.id.btn_submit); b.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { //Place code to handle button click here //Get input data from XML file and assign values to titles Username = this.findViewById(R.id.nameUser); Partnername = this.findViewById(R.id.namePartner); Partneremail = this.findViewById(R.id.emailPartner); Password = this.findViewById(R.id.pswdAdmin); /* Create an Intent to start * MySecondActivity. */ Intent i = new Intent( LayoutTest1.this, Preferences.class); /* Send intent to the OS to make * * it aware that we want to start * * MySecondActivity as a SubActivity. */ startActivityForResult(i, 0x1337); } private String findViewById(int nameUser) { // TODO Auto-generated method stub return null; } }); }} **********************************Preferences.java****************************** (Second Activity) package com.toadster.layouttrial1; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class Preferences extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.prefs); } } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

