Antonio Antonio - 15 days ago 5
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

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");
            startActivity(intent);

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

String str=getIntent().getStringExtra("ANY_KEY");