Android Question Share App

iCAB

Well-Known Member
Licensed User
Longtime User
Hi All

I was using ahaShare & the code below for app sharing

B4X:
    Share.Initialize(Me, "Share")
    Share.Share("test", "Share Text")

At a certain point it was working fine, but now I am getting the following error:

java.lang.NullPointerException: Attempt to read from field 'java.lang.ref.WeakReference anywheresoftware.b4a.BA$SharedProcessBA.activityBA' on a null object reference

I am also getting the same error with the sample project.

1. I was wondering if there is a solution to fix the above problem

2. Is there a way to call the standard system share as in the link below:
https://developer.android.com/training/sharing/shareaction.html


Thanks in advance
 
Last edited:

sorex

Expert
Licensed User
Longtime User
you can use this to get a pop-up where they can select the app to share it with

B4X:
 Dim i As Intent
i.Initialize(i.ACTION_SEND, "")
i.SetType("text/plain")
i.PutExtra("android.intent.extra.TEXT", "my text")
i.WrapAsIntentChooser("some info text")
StartActivity(i)
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
you can use this to get a pop-up where they can select the app to share it with

B4X:
 Dim i As Intent
i.Initialize(i.ACTION_SEND, "")
i.SetType("text/plain")
i.PutExtra("android.intent.extra.TEXT", "my text")
i.WrapAsIntentChooser("some info text")
StartActivity(i)

Hi Sorex
This is exactly what I was looking for. Now I just have to figure out how to attach and image/icon and I'm done.

Thanks for your help.
 
Upvote 0
Top