I have an input box (EditText1) 1. that i want to keep adding values
and save them to an Array 2. then when am done, i can click the done
button and it can take me to the next screen and I can display the
values or call the values of the array.. this is what i have so far 1.
Done Button Works 2. Add more button and storing to array doesn't
quite work....HELP PLZ,

Thanks

public class Screen2 extends Activity {
private EditText txt1;
String ag;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.screen2);

    // edittext1 or textview1
    txt1 = (EditText) findViewById(R.id.editText1);
    ag = txt1.getText().toString();

    // done button
    // -----done button-------
    Button done = (Button) findViewById(R.id.button2);
    done.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {

        if(txt1.getText().length() != 0){
            String ag = "Players:," +txt1.getText().toString();
            Toast.makeText(getBaseContext(), ag,
            Toast.LENGTH_SHORT).show();

        Intent myIntent = new Intent(view.getContext(),
            Screen3.class);
                startActivityForResult(myIntent, 0);

        }else if (txt1.getText().length() == 0){
            String ag = "Error!! Enter Player Name";
                Toast.makeText(getBaseContext(), ag,
        Toast.LENGTH_SHORT).show();
        }}

        });

    //add more items button need help on how to go about the array
    Button more = (Button) findViewById(R.id.button1);
    more.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view){
            Intent myIntent = new Intent(view.getContext(),
                    Screen2.class);
                        startActivityForResult(myIntent, 0);
        }

    });

}}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to