passing arrays using bundle in android

后端 未结 5 1758
没有蜡笔的小新
没有蜡笔的小新 2020-12-28 19:19

I need to pass an array of String/integer values from one Activity to another. How do I achieve this?

5条回答
  •  [愿得一人]
    2020-12-28 19:43

    In activity A:

    String[] abc;
    
    Bundle bundle =new Bundle();
    bundle.putStringArray("some string",abc);
    

    In Activity B where you want to get give the code as:

    String abcd[]=bundle.getStringArray("some string");
    

    "some string" should be same in both case.

提交回复
热议问题