Hi Dilip,
You can use getPackageManager() for this. Use the below code.
List<ResolveInfo> mApps;
Intent mainIntent = new Intent(Intent.ACTION_MAIN,
null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
mApps =
getPackageManager().queryIntentActivities(mainIntent, 0);
Intent intent[]=new Intent[mApps.size()];
System.out.println("SIZEEEEEEEEEEEE " +
mApps.size());
for (int j = 0; j <mApps.size(); j++) {
intent[j]=new
Intent(Intent.ACTION_MAIN);
intent[j].addCategory(Intent.CATEGORY_LAUNCHER);
ResolveInfo info = mApps.get(j);
if(info.activityInfo.applicationInfo.packageName.equals("//GIVE THE
PACKAGE NAME OF THE APP U WANT TO LAUNCH"))
{
intent[j].setComponent(new
ComponentName(
info.activityInfo.applicationInfo.packageName,
info.activityInfo.name));
intent[j].setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
startActivity(intent[j]);
}
}
You will get the package name from logcat. Do adb logcat and launch
the application(eg. Browser). Then you can identify the package name.
The same you can use in the above code.
Hope this will help u.
Cheers,
SREEHARI.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en