-2

I want to send the List data using putStringArrayListExtra

@Override
    protected void onPostExecute(List<MainActivityModel> result) {
        super.onPostExecute(result);

        Intent intent = new Intent(SplashScreen.this,MainActivity.class);
        intent.putStringArrayListExtra("data", result); 
         startActivity(intent);
    }
Gowtham Subramaniam
  • 3,358
  • 2
  • 19
  • 31
hitesh
  • 13
  • 1
  • 6

3 Answers3

0

Implement Parcelable in your List and use putParcelableArrayList. Docs

Veneet Reddy
  • 2,707
  • 1
  • 24
  • 40
0

Make your custom list Parcelable

intent.putExtra("CustomDataList", mCustomDataList);

Use it in the new Activity Like this :

Bundle data= getIntent().getExtras();
CustomList newList = (CustomList) data.getParcelable("CustomDataList");

For more on Parcelable you can refer: How can I make my custom objects Parcelable?

Community
  • 1
  • 1
AndroidBeginner
  • 663
  • 1
  • 9
  • 16
0

You need that to your model implemented interface Parcelable. And use putParcelableArrayListExtra method