Android Question Sending text between two apps

apty

Active Member
Licensed User
Longtime User
I have two apps with different package names. I can launch an activity in the second app from the first app using intents. Now i want to pass the first app's name to the second app and display it in the textbox of the activity launched from first app (i.e. when first app calls second app's activity, the activity displays with a textbox that shows first app's name).
I need some help on how to do this..Thanks
 

MikeH

Well-Known Member
Licensed User
Longtime User
One way is to put the text into the copy buffer from app 1 and read it from app 2
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can also use the intent itself to send more data.
B4X:
Dim in As Intent
in.Initialize(in.ACTION_MAIN, "")
in.SetComponent("...")
in.PutExtra("name", "myname")
StartActivity(in)
You can use Activity.GetStartingIntent to get the intent that caused the activity to start and then fetch the values.

(make sure to check that the intent is new: https://www.b4x.com/android/forum/t...intent-be-reset-or-cleared.38004/#post-224814 )
 
Upvote 0

apty

Active Member
Licensed User
Longtime User
Thanks a lot Erel and DonManfred. What i wanted to do is pass some text and image from app one to app two. I have managed to pass the text. Now in app one i have an image in an image view, i wanted to pass that to an imageview in app two through an intent.
I am thinking i should pass the image as bytes (through clipboard maybe) and convert the bytes back in app two in to an image..Is there a better way of doing this?
 
Upvote 0
Top