Reputation: 105
I have a class called DownloadInfo that consists of a progressBar and two textView , how can I send it via intent and maintain the object at the other side ?
Upvotes: 1
Views: 60
Reputation: 1627
Implement Serializable
to DownloadInfo
class.
Intent intent = new Intent(Youractivity.this, OtherActivity.class);
Bundle args = new Bundle();
args.putSerializable("downloadInfo", DownloadInfo object);
intent.putExtras(args);
On other side:
if (getIntent().hasExtra("downloadInfo"))
downloadInfo = (DownloadInfo) getIntent().getExtras().getSerializable("downloadInfo");
Upvotes: 1