I was making an application where I chose image file using browser intent and process it using OpenCV NDK. I decided to keep a different Activity for the OpenCV part and hence I had to pass the bitmap data from my main Activity to the OpenCV part activity. I had written an application before where I starting one intent from another activity. But I did not know how to pass arguments to the new activity. I looked up on Google and found out how to call another activity and then how to pass required data.
Start New Activity from Current Activity
Start New Acticity from Current Activity With Passing Required Data
putExtra() method is used to send extra data from one activity to another.
Extract Data In Other Activity
getIntent() method returns the intent that started this activity.
getStringExtra() retrieves extended data from the intent.
Now, it turns out that it’s not possible to pass Bitmap as extended data. It needs to be converted to
Pass Bitamp as Extended Data
Retrieve Bitmap in Other Activity
Well, that’s how I pass bitmap data between two activities. There are some better methods to do this such as passing fileURIs.
P.S. Working on Android now. Need to get better at layouts and designs.