Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (10.2k points)
In my activity, I create a Bitmap object and then I need to launch another Activity, How can I pass this Bitmap object from the sub-activity (the one which is going to be launched)?

1 Answer

0 votes
by (46k points)

Bitmap implements Parcelable, so you could always pass it with the intent:

Intent intent = new Intent(this, NewActivity.class);

intent.putExtra("BitmapImage", bitmap);

and retrieve it on the other end:

Intent intent = getIntent(); 

Bitmap bitmap = (Bitmap) intent.getParcelableExtra("BitmapImage");

Related questions

0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...