I want to open an application from my app and then press one of its button as it opens.
Asked
Active
Viewed 126 times
2 Answers
3
Assuming you know the package name of the application, You can use the following code below
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
startActivity(launchIntent);

Vinay Jayaram
- 1,030
- 9
- 29
-
and what about pressing any button in that application as it opens? – user3134148 May 19 '15 at 09:48
-
I did not get your question – Vinay Jayaram May 19 '15 at 09:49
-
what about pressing button of launched application programmaticly ? – N J May 19 '15 at 09:50
-
i want to open the application and then press any of its button by code first as it opens! did this cleared things? – user3134148 May 19 '15 at 09:51
-
You want to simulate the click of a button on an external application? If so, you cant. – Ed Holloway-George May 19 '15 at 09:53
-
You cannot do it as far as i know – Vinay Jayaram May 19 '15 at 09:53
-
Not unless the application you open uses intent parameters to perform actions. But if you have **not** created the application you are opening, you have no way of knowing if that is the case. – Ed Holloway-George May 19 '15 at 10:10
0
Launch an application from another application on Android to start the other application you can then pass data in the intent such as
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
startActivity(launchIntent);
intent.launchIntent("PushButtonId", buttonId);
startActivity(intent)
Then retrieve datas int the started app
String text = myIntent.getStringExtra("PushButtonId");

Community
- 1
- 1

Lary Ciminera
- 1,270
- 8
- 15
-
This will only work if you have access to the source code of the application that is to be opened, and know that the intent will be used to perform an action. This is _not_ a general solution to the question as one does not exist. – Ed Holloway-George May 19 '15 at 10:12
-
yes you are right, i may have made too many assumption from this short answer. – Lary Ciminera May 19 '15 at 10:18