Launch any application by command line

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Launch any application by command line

Postby Profete162 » Thu Jan 14, 2010 12:47 am

Hello!

I would like to program a "task switcher". For that, i got all the running apps with this command:

Code: Select all
List<ActivityManager.RunningTaskInfo> allTasks = activityManager.getRunningTasks(30);


So that's nice, i can kill every one of them i want with the ID, but i cannot understant how to launch one of the.

I tried the startactivity, but i need an intent, i am not able to figure how to create the intent...

Could you please help me?

Thank a lot.
Profete162
Experienced Developer
Experienced Developer
 
Posts: 67
Joined: Fri Nov 27, 2009 6:07 pm

Top

Postby michael_g_hu » Thu Jan 14, 2010 10:25 am

yes, I think you have already get the application package(string) right?
so you can get the applicationinfo by using the package -> app = ActivityManaager.getApplicationInfo(String packageName, int flags)
then you need to do is call startActivity(app.intent);
michael_g_hu
Developer
Developer
 
Posts: 35
Joined: Fri Mar 21, 2008 9:46 am

Postby Profete162 » Thu Jan 14, 2010 5:36 pm

Thank a lot! it works!
Profete162
Experienced Developer
Experienced Developer
 
Posts: 67
Joined: Fri Nov 27, 2009 6:07 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests