Share Coding

Tutorials, Problems, Stuffs …

Android Pass object between Intent

1. First of all, your Object class must be

implements Serializable

2. Package your parameter into a Bundle

User user1= new User("user1", "M");
Bundle bundle = new Bundle();
bundle.putSerializable("USER", user1);

3. Put bundle into Intent

Intent intent = new Intent(EntryPoint.this, Home.class);
intent.putExtras(bundle);
startActivity(intent);

4. Receive Extra

Intent intent = this.getIntent();
Bundle bundle = intent.getExtras();

User user1 = (User ) bundle.getSerializable("USER");
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: