Android: How can I launch shortcut of a certain app in my own application? -
thanks click question.
i'm developing kinds of beginner-level apps, , wondering possible launch shortcut(not app. itself) in own application.
actually, found way launch apps package names, need start shortcuts(which located in homescreen) when touch special button in app.
is there way said?
best regards.
may useful, how classes manifest, i'd know http://www.tutorialforandroid.com/2009/10/launching-other-application-using-code.html
say want open fuelgauge, this.
final intent intent = new intent(intent.action_main, null); intent.addcategory(intent.category_launcher); final componentname cn = new componentname("com.android.settings","com.android.settings.fuelgauge.powerusagesummary"); intent.setcomponent(cn); intent.setflags(intent.flag_activity_new_task); startactivity( intent);
explanation open other people's application, need make sure in manifest file, author specify class have android.intent.action.main intent-filter added them.
final intent intent = new intent(intent.action_main, null);
we add category new intent launching something
intent.addcategory(intent.category_launcher);
then identify application need open using componentname, here specify package name of application first argument , class want open second one. must understand com.android.settings has lot of classes have main intent-filter under making second argument specific class need. (this more 1 line)
final componentname cn = new componentname("com.android.settings", "com.android.settings.fuelgauge.powerusagesummary");
after identify component want, set our intent
intent.setcomponent(cn);
we tell intent open opening 1 make new task
intent.setflags(intent.flag_activity_new_task);
then start our intent
startactivity( intent);
Comments
Post a Comment