Reputation: 29
final List<PackageInfo> packs = getPackageManager().getInstalledPackages(0);
The above PackageInfo class for get the list of packages then
get package names for :
ViewHendler hendler = new ViewHendler();
hendler.textLable = (TextView)convertView.findViewById(R.id.textView);
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage(packageName);
startActivity( LaunchIntent );
then start applicathin using package name call :launchApp(packageName)
void launchApp(String packageName) {
Intent mIntent = getPackageManager().getLaunchIntentForPackage(packageName);
if (mIntent != null) {
try {
startActivity(mIntent);
} catch (ActivityNotFoundException err) {
Toast t = Toast.makeText(getApplicationContext(),
R.string.app_not_found, Toast.LENGTH_SHORT);
t.show();
}
}
}
But didn't get result(start another application from my application).
Upvotes: 1
Views: 152
Reputation: 6960
It's right way to use:
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.package.name");
startActivity(LaunchIntent);
But probably you have no permission, or you don't have application there.
Firstly check your packageName
parameter.
Upvotes: 1