Antonio Antonio - 1 year ago 77
Android Question

Transfer a string from list view on one activity to another in android

How is it possible to transfer a string from a listView on click and use the string saved in a variable in a different activity?

Answer Source

You can do this by writing code for calling next activity in listview's item click event

Intent intent= new Intent(getBaseContext(),AnotherActivity.class);
            intent.putExtra("ANY_KEY", "YOUR STRING VALUE");

Then in other activity's on create method get value of your string by

String str=getIntent().getStringExtra("ANY_KEY");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download