I want to start an another application when a button is clicked in an application.
How this can be done?
And if another application is not installed in device then it will download the app from given Uri. How to do that?
So how I can set CONTENT URI?
Asked
Active
Viewed 176 times
-6

Vaibhav Devpura
- 108
- 7
-
4Please start by reading: [how to start new activity on button click](http://stackoverflow.com/q/4186021/1267661) – Sam Jan 04 '13 at 17:03
1 Answers
2
This code will start an Activity to a Barcode scanner Application:
try {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); //this line is optional, you can pass extra information to the app with this code
startActivityForResult(intent, 0);
} catch (Exception e) {
Uri marketUri = Uri.parse("market://details?id=com.google.zxing.client.android");
Intent marketIntent = new Intent(Intent.ACTION_VIEW,marketUri);
startActivity(marketIntent);
}
You can start a new Activity with this code:
Intent i = new Intent(MainActivity.this, MakeKey.class);
startActivity(i);
finish();
MainActivity is the current Activity and MakeKey.class is the Target Activity, just edit this code.