Android Question Simple Media Manager - get bitmap ?

derez

Expert
Licensed User
Longtime User
I'm using smm and want to save the bitmap which is set to the specified panel. The image is said to be on view(0) on the panel, which is said to be b4ximageview. I would like to know how to get the bitmap for saving it.
B4X: Copy
Dim vx As B4XImageView = Picpnl.GetView(0)
This gives "types do not match"
 
Upvote 0
I get
java.lang.IllegalArgumentException: field b4a.example.b4xmainpage._vx has type b4a.example.b4ximageview, got java.lang.String
The Tag is interpreted as a regular tag, a string.
 
Last edited:
Upvote 0
Perhaps it is not the only view in the Picpnl. What do you get with this?
B4X: Copy
    For i = 0 To Picpnl.NumberOfViews - 1
        Dim vw As B4XView = Root.GetView(i)
        If Not(vw.Tag Is String) Then
            Log(i & TAB & GetType(vw.tag))
        End If
    Next

Also this is a custom view and should be added with designer and .loadlayout.
 
Upvote 0
The solution to my question is actually much simpler , although not the exact answer to the question, to use result.mediafile :
B4X: Copy
Private Sub ShowMedia (Result As MediaChooserResult)
   
    If Result.Success Then
        smm.SetMediaFromFile(design.Picpnl, Result.MediaDir, Result.MediaFile, Result.Mime, Null)
       File.Copy(Result.MediaDir, Result.MediaFile, rp.GetSafeDirDefaultExternal(""), "temp.jpg")
        B4XPages.ShowPage("design")
    Else
        design.Picpnl.RemoveAllViews
    End If

End Sub
 
Upvote 0
Back
Top