Cómo iniciar una Intent desde un ResolveInfo


Estoy tratando de hacer un lanzador personalizado para Android, y estoy tratando de averiguar cómo iniciar una mina de formulario de aplicación diferente. Pensé que la manera de hacerlo era intents, y he encontrado un post sobre él aquí:

Abra otra aplicación desde su propia (intent)

¡Realmente no entiendo la respuesta! ¿Puede alguien darme un fragmento conciso o una serie de pasos para pasar de un solo ResolveInfo a iniciar la aplicación representada por ese ResolveInfo?

Author: Community, 2012-09-20

2 answers

Dado un ResolveInfo llamado launchable:

ActivityInfo activity=launchable.activityInfo;
ComponentName name=new ComponentName(activity.applicationInfo.packageName,
                                     activity.name);
Intent i=new Intent(Intent.ACTION_MAIN);

i.addCategory(Intent.CATEGORY_LAUNCHER);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
            Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
i.setComponent(name);

startActivity(i);

(de https://github.com/commonsguy/cw-omnibus/tree/master/Introspection/Launchalot)

 43
Author: CommonsWare,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-09-20 11:09:41

Crea una nueva Intent de esta manera.

    Intent intent = new Intent();
    intent.setClassName(resolveInfo.activityInfo.applicationInfo.packageName,
            resolveInfo.activityInfo.name);
    startActivity(intent);
 20
Author: Daniel De León,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-06-02 23:08:00