I have a string array that has multiple strings in listview, e.g. {Apples, Oranges, Banana, ...etc}. What I want is that if a user choses more than one item, say Oranges & Banana, then a text is added to Oranges and Banana. Then added to intent, send it to another activity. Code like this:
if(selected.get(i).equals("Oranges"){
Textview tOrange = (TextView) findViewById(R.id.t1);
tOrange.setText("Oranges are sour");
}
if(selected.get(i).equals("Banana"){
Textview tBanana = (TextView) findViewById(R.id.t1);
tBanana.setText("Banana is healthy");
}
Intent c = new Intent(Main.this, MyFruits.class);
Bundle b = new Bundle();
b.putString("tOrange", tPnP.getText().toString());
b.putString("tBanana", tCheckers.getText().toString());
c.putExtras(b);
startActivity(c);
Now I want activity MyFruits.class to display the two textviews, i.e. "Oranges are sour" and "Bananas is healthy"
Aucun commentaire:
Enregistrer un commentaire