user1955351
user1955351

Reputation: 31

Inter Application Communication in Android

I have an activity in one application that calls the activity of another application. How can be done with intent or any other way. For example in single application, we can do it like:

Intent i = new Intent(this, ActivityTwo.class);
i.putExtra("Value1", "This value is sent by FirstActivity ");

Upvotes: 2

Views: 7455

Answers (2)

ben75
ben75

Reputation: 28706

You can use Intent.setComponent

Upvotes: 0

TNR
TNR

Reputation: 5869

Declare android action for the Second Activity and call the Second Activity from First Activity through the Action name. For more info see the below example:

Declared Second Activity in AndroidManifest.xml as

<activity android:name=".SecondActivity">
<intent-filter>
<action android:name="com.sample.action.MY_CUSTOM_ACTION"/>
</intent-filter>
</activity>

Then install the second app first and call the SecondActivity as below:

Intent i = new Intent("com.sample.action.MY_CUSTOM_ACTION");
i.putExtra("mystring","Sample Text");//optional.
startActivity(i);

Upvotes: 1

Related Questions