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);

4. Receive Extra

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

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

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: