Android Question Get Bitmap from an intent

Johan Schoeman

Expert
Licensed User
Longtime User
Please help a "dummy" with retrieving a Bitmap from an intent. The library defines the key as:
B4X:
public static final String KEY_PHOTO = "photo";

And this is how it gets the Bitmap from the intent to add it to an ImageView:
B4X:
        if (getIntent().hasExtra(KEY_PHOTO)) {
            ((ImageView) findViewById(R.id.view_photo)).setImageBitmap((Bitmap) getIntent().getParcelableExtra(KEY_PHOTO));

So, what would B4A equivalent be to extract the Bitmap from the returned intent (I can already extract all the Strings in the returned intent). Should it be as below?

B4X:
        Dim jo As JavaObject = i
        Dim mbm As Bitmap = jo.RunMethod("getParcelableExtra", Array As Object("photo"))

I am just very in(tent)experienced....
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
Array = Array As Object

What happens with the code you posted?
Waiting someone that I a trying to assist to test it.
Erel, not sure what you mean with

Array = Array As Object

The b4a code above does have Array as Object("photo")
 
Upvote 0
Top