在activity发送数组:
public static String [] PhoneAndTime = new String[2];
//new 新的Intent
Intent data = new Intent(MainActivity.this, Demo_1.class);
//用Bundle 携带数组
Bundle bundle = new Bundle();
bundle.putStringArray("phone_data", PhoneAndTime);
//将 data Intent 添加Bundle
data.putExtras(bundle);
startActivity(data);在另外一个activity中取得数组:
Bundle bundle = this.getIntent().getExtras();
String [] data = bundle.getStringArray("phone_data");
本文介绍了一种在Android应用程序的不同活动(activity)之间通过Intent和Bundle传递数组数据的方法。具体步骤包括:创建数组、使用Intent连接活动、利用Bundle打包数据、解析接收端的数据。
2264

被折叠的 条评论
为什么被折叠?



