Passing ArrayList between tabs

后端 未结 3 1517
没有蜡笔的小新
没有蜡笔的小新 2021-01-07 02:25

I\'m not very clear about the Intent object and how to use it to pass data between Activities. In my application I have several tabs between which I want to pass ArrayList.

3条回答
  •  执笔经年
    2021-01-07 03:02

    With the examples above, it was really work when I replace the "onStop" = "onPause"

    /** Called when the activity looses focus **/
    @Override public void onStop()
    {
        Intent myIntent = new Intent();
        myIntent.putStringArrayListExtra("arrayPeople", arrayPeople);
        this.setIntent(myIntent);
    }
    
    /** Called when the activity looses focus **/
    @Override public void onPause()
    {
        Intent myIntent = new Intent();
        myIntent.putStringArrayListExtra("arrayPeople", arrayPeople);
        this.setIntent(myIntent);
    }
    

提交回复
热议问题