0

Is there a way how to pass list of lists with my parcelable objects?

 public void listDataSms(ArrayList<MySmsLog> stringList) {
    Bundle bundle = new Bundle();
    bundle.putParcelableArrayList(NUMBER_LIST, stringList);
    Intent i = new Intent(this, MyCommonListActivity.class);
    i.putExtra(WHO_INT, SMS_LOG);
    i.putExtras(bundle);
    startActivityForResult(i, SMS_LOG);

i have this working but now i need to pass this somehow

public void listDataSmsAll(ArrayList<ArrayList<MySmsLog>> stringList)
Blackess
  • 117
  • 1
  • 10
  • You can serialize it into a JSON string and pass it with the bundle and deserialize it in the receiving Activity. You can also save it in the Application object. – SuperFrog Jul 22 '15 at 22:48
  • If its array you use often then put it inside database and retrieve anywhere you want. –  Jul 22 '15 at 23:10

1 Answers1

0

One option could be letting your custom class implement Serializable interface and then you can pass object instances in intent extra using putExtra(Serializable..) variant of the Intent#putExtra() method.

PSEUDO code:

//to pass :
   intent.putExtra("MyClass", obj);  

// to retrieve object in second Activity
getIntent().getSerializableExtra("MyClass");

How to pass an object from one activity to another on Android

Community
  • 1
  • 1
StephenG
  • 2,851
  • 1
  • 16
  • 36