I use this code to save the contents of a textbox to an array, i want display this array in a list view on another activity.
any idea about this? thanks.
txt = (TextView)findViewById(R.id.name);
show = (ListView)findViewById(R.id.mygardenlist);
add = (Button)findViewById(R.id.btnAdd);
add.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String getInput = txt.getText().toString();
if(addArray.contains(getInput)) {
Toast.makeText((getBaseContext()), "Plant Already Added", Toast.LENGTH_LONG).show();
}
else {
addArray.add(getInput);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(SingleItemView.this, android.R.layout.simple_list_item_1, addArray);
show.setAdapter(adapter);
((TextView)findViewById(R.id.name)).setText(" ");
}
}
});