Android Question SMM Invalid link error

Drago Bratko

Active Member
Licensed User
Longtime User
I have this code :

B4X:
Sub Camera1_PictureTaken (Data() As Byte)
    Dim filename As String = "cp.jpg"
    Dim dir As String = File.DirInternal

    camEx.SavePictureToFile(Data, dir, filename)
End Sub

Private Sub ShowImage
    Dim filename As String = "cp.jpg"
    Dim dir As String = File.DirInternal
    Dim uri As String = xui.FileUri(File.DirInternal, filename)

    If File.Exists(dir, filename) Then
        MediaManager.Initialize
        SetZoomImageViewMedia(pnlImage, uri, Colors.White)
    End If
End Sub

Private Sub SetZoomImageViewMedia(Panel As B4XView, Url As String, BackgroundColor As Int)
    MediaManager.SetMediaWithExtra(Panel, Url, "", CreateMap(MediaManager.REQUEST_CALLBACK: Me, MediaManager.REQUEST_ZOOMIMAGEVIEW: True, _
        MediaManager.REQUEST_BACKGROUND: BackgroundColor))
    Wait For (Panel) SMM_MediaReady (Success As Boolean, Media As SMMedia)
    If Success Then
        Dim zv As ZoomImageView = Panel.GetView(0).Tag
        zv.pnlBackground.Color = BackgroundColor
        zv.mBase.Color = BackgroundColor
    End If
End Sub

First it's called "Camera1_PictureTaken", then "ShowImage" which calls "SetZoomImageViewMedia".
In SetZoomImageViewMedia, frsit line (MediaManager.SetMediaWithExtra) I got error : Invalid link: file:///data/user/0/softwise.ebrojilo/files/cp.jpg
File, of course exists as check on "ShowImage" is true (If File.Exists(dir, filename) Then).

What I'm doing wrong?
 

Drago Bratko

Active Member
Licensed User
Longtime User
Thank you Erer, that works in the way that image is loaded to panel, and orientation is correct. Great!
But, what I intent to do (by using "REQUEST_ZOOMIMAGEVIEW" in Extra map parameter) is to be able to pan/zoom image, which is not working right now.
Is there a way to make it work?
 
Upvote 0

Drago Bratko

Active Member
Licensed User
Longtime User
Here is example. When picture is taken, on page "PicturePreview" it should be posible to zoom and pan ... but it's not possible. Thank you for checking it.
 

Attachments

  • eBrojiloTest.zip
    15.3 KB · Views: 21
Upvote 0

teddybear

Well-Known Member
Licensed User
Here is example. When picture is taken, on page "PicturePreview" it should be posible to zoom and pan ... but it's not possible. Thank you for checking it.
You are missing the Conditional Symbol SMM_ZOOM.
 
Upvote 0
Top