intent传递字符串数组

传递:

Bundle b=new Bundle();

b.putStringArray(key, new String[]{value1, value2});

Intent i=new Intent(context, Class);

i.putExtras(b);

eg:

Intent intent = new Intent();
    intent.setClass(VideoActivity.this, PlayActivity.class);
 
    Bundle bundle=new Bundle();
    bundle.putStringArray("video", videolist);
    intent.putExtras(bundle);
   
    startActivity(intent);

接受:

Bundle b=this.getIntent().getExtras();

String[] array=b.getStringArray(key);

 

eg:

Intent intent = this.getIntent();

bundle = intent.getExtras();
  videolist = bundle.getStringArray("video");

你可能感兴趣的:(android)