I want to send ArrayList of class object type from one activity to another activity but, it gives me an error please help me. I have tried many links but, my problem did not solve. FATAL EXCEPTION MAIN: Java.Lang.RuntimeException I have tried these links: Passing ArrayList with objects to new Activity? How to pass ArrayList of Objects from one to another activity using Intent in android?
//Sending Side Code:
if(result.size()>0)
{
ArrayList< LogSetGet> lst=new ArrayList<LogSetGet>();
lst=result;
Intent i=new Intent(LogIn.this,Home.class);
i.putExtra("list",result);
startActivity(i);
}
//Receiving side Code:
Intent i=this.getIntent();
ArrayList<LogSetGet>ls=ArrayList<LogSetGet>)i.getSerializableExtra("list");
ArrayAdapter<LogSetGet> adptr=new ArrayAdapter<LogSetGet>(Home.this,android.R.layout.simple_list_item_1,ls);
lv.setAdapter(adptr);
Thank you in advance.
you write this
class LogSetGet implements Serializable{
}
and
if(result.size()>0){
ArrayList< LogSetGet> lst=new ArrayList<LogSetGet>();
lst=result;
Intent i=new Intent(LogIn.this,Home.class);
i.putExtra("list",result);
startActivity(i);
}
hope you get this
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments