Ibrahim Magdy
Ibrahim Magdy

Reputation: 169

how to send a string to listView in another activity ? in android

Good evening guys, I'm making an app and I want to know how to send a string to "List-View" in another activity ?

Upvotes: 0

Views: 101

Answers (1)

Abhinav Arora
Abhinav Arora

Reputation: 537

You can send data using the following code -

Intent intent = new Intent(this,newActivity);
intent.putExtra(name, value)

name = The name of the extra data value = The String data value.

startActivity(intent);

In the new activity, you receive string via following (in onCreate)

Intent intent = getIntent();
String str = intent.getString(name)

name = The name of the extra data

Now search the web on how to add a string to list view. You will find it easily

Upvotes: 1

Related Questions