0
public void passData(){
Post post=new Post("title","name","25000");
Intent intent = new Intent(this, Test.class);
intent.putExtra("post", post);`
startActivity(intent);
}
ADM
  • 20,406
  • 11
  • 52
  • 83
a validi
  • 1
  • 1

1 Answers1

0

try this one it very simple way to pass

public void passData(){
Post post=new Post("title","name","25000");
Intent intent = new Intent(this, Test.class);
intent.putExtra("post", new Gson().toJson(post));
startActivity(intent);
}

in another activity

Intent intent=new Intent()
Post post=Gson().fromJson(intent.getString("post"),Post.class);

   
Amit pandey
  • 1,149
  • 1
  • 4
  • 15