Android Question Sharing a panel with different views to whats app as image

Juzer Hussain

Active Member
Licensed User
Longtime User
Hi Freinds,

I would like to know the best way to share a panel (containing different views) with Whatsapp as image.

I am not using B4XPages yet.

Pls give some clue.

Thanks

Juzer A.
 

JohnC

Expert
Licensed User
Longtime User
I would take a screen shot of your panel, then send the screenshot image to Whatsapp:

 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
I would take a screen shot of your panel, then send the screenshot image to Whatsapp:


Thanks JohnC,
That won't do as panel is much smaller then activity.
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Even simpler using with B4XView snapshot method :)

B4X:
    Dim px As B4XView = myPanel              '<-- your panel containing the different views
    Dim bx As B4XBitmap = px.Snapshot

Thanks JordiCP,
We got the panel as bmp , Pls inform how to share this to whats app.
Mine is an old project without B4XPages.

Juzer
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
This worked
Added Fileprovider class by Erel and modified the manifest

PP_SharePanel:
Sub ShareIt
    Dim px As B4XView
    
    px=pnlCard
    bx= px.Snapshot
    
    File.Delete(File.DirInternal & "/xxx/Temp","tmp.jpg")
    
    Dim out As OutputStream
    out=File.OpenOutput(File.DirInternal & "/xxx/Temp","tmp.jpg",True)
    bx.WriteToStream(out,100,"JPEG")
    
    Dim FileName As String = "tmp.jpg"
    File.Copy(File.DirInternal & "/xxx/Temp", FileName, starter.Provider.SharedFolder, FileName)

    Dim in As Intent
    in.Initialize(in.ACTION_SEND, "")
    in.SetType("image/*")
    in.PutExtra("android.intent.extra.STREAM", starter.Provider.GetFileUri(FileName))
    in.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
    StartActivity(in)
End Sub
 
Upvote 0
Top