Appeler une application depuis une autre application
bonjours, je souhaite appeler une application depuis mon application. Comment peut on le faire?
Après avoir cherché sur google j'ai trouvé ces 2 morceaux de codes qui ne fonctionnent pas chez moi.
http://stackoverflow.com/questions/2...id-application
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| Intent intent = new Intent(Intent.ACTION_RUN);
intent.setComponent(new ComponentName("<packet name>", "<class name>"));
List list = packageManager.queryIntentActivities(intent, packageManager.COMPONENT_ENABLED_STATE_DEFAULT);
if(list.size() > 0)
{
Log.i("Log", "Have application" + list.size());
startActivity(intent);
}
else
{
Log.i("Log", "None application");
} |
J'ai été voir sur android developpers pour comprendre comment fonctionne ComponentName. Ils disent qu'il faut 2 pièces d'informations comprenant
Citation:
(Activity, Service, BroadcastReceiver, or ContentProvider)
QUe veulent ils dire avec ça, es ce le lien vers l'activité, le service de l'application appelée qu'ils veulent?
et à ce lien
http://www.anddev.org/install-run_ap...ion-t6909.html
Code:
1 2 3 4 5 6
|
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive");
startActivity(intent); |
merci beaucoups d'avance:P