Android Question How to initialize bitmap in this context?

Troberg

Well-Known Member
Licensed User
Longtime User
I have the following code, and I get an error complaining that the bitmap is not initialized

B4X:
    Dim rfl As Reflector
    Dim obj As Object
    Dim B As Bitmap

    obj = rfl.CreateObject("android.media.MediaMetadataRetriever")
    rfl.Target = obj
    rfl.RunMethod2("setDataSource", vidfile, "java.lang.String")
    B = rfl.RunMethod3("getFrameAtTime", 0, "java.lang.long", 3, "java.lang.int")
      
    Dim HV As Int = B.Height 'Error on this line
    Dim WV As Int = B.Width

The strange thing is that I only get it on some devices. How should it be initialized in this context, where something will be assigned to it just afterwards?
 

Cableguy

Expert
Licensed User
Longtime User
Bitmaps are just place-holders, so after dimming it, call bitmap.initialize with the fewer args possible...
You can reassign which ever bitmap you want, when you want...
 
Upvote 0
Top