简体   繁体   中英

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

晚上好,我正在制作一个应用程序,我想知道如何在另一个活动中将字符串发送到“列表视图”吗?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM