观心静

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

在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");

posted on 2018-03-15 20:50  观心静  阅读(236)  评论(0编辑  收藏  举报