How to share the content?

susu

Well-Known Member
Licensed User
Longtime User
I want to make a button that can share the content (sms, email, facebook...). I tried these code but failed, please help.

B4X:
Dim intent1 As Intent
Intent1.Initialize(Intent1.ACTION_SEND, "")
Intent1.SetType("plain/text")
Intent1.PutExtra("text", Content.Text)
StartActivity(Intent1)
 

susu

Well-Known Member
Licensed User
Longtime User
Thanks Erel.
I read about "intent" for hours but couldn't get a clue :(
 
Upvote 0

Stulish

Active Member
Licensed User
Longtime User
Hi,

I have got a button on an app so the user can click to link the download page to facebook.

Using the code below it all works fine and links the page, the problem i have is that it displays a list of all apps, i tried to set the component to com.facebook.katana so that it would use the facebook app, but it still displays all apps.

is there a way so that it shows onlt facebook, or goes directly to facebook instead of displaying all apps.

B4X:
Dim i As Intent
i.Initialize(i.ACTION_SEND, "")
i.SetType("text/plain")
i.PutExtra("android.intent.extra.TEXT", "http://www.b4x.com/")
i.SetComponent("com.facebook.katana")
StartActivity(i)

Thanks
 
Upvote 0

ChrShe

Member
Licensed User
Longtime User
I'm using the code that Stulish posted to get my app to be able to share to more than email.
Now I'm wondering if there's a way to intercept the Share Using dialog so that I could do specific things depending on what they want to share to...?

i.e. If sharing to Facebook or G+, just push the link.
If sharing via email/gmail, create an email body/subject/attachement.

Many thanks!
Chris
 
Upvote 0

ChrShe

Member
Licensed User
Longtime User
Is there a way, you can think of, to do it without the Phone library?

It seems...If I add the Phone library, the Play Store won't make my app available to WiFi only devices. :(

Thanks!
 
Upvote 0

ChrShe

Member
Licensed User
Longtime User
OOOHHH!!! That makes sense...and makes my morning easier. :sign0060:

Thank you!
 
Upvote 0
Top