标签:android style blog io ar color sp on div
1 public void openApp(String packageName, Context context) { 2 PackageManager packageManager = context.getPackageManager(); 3 Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null); 4 resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER); 5 resolveIntent.setPackage(packageName); 6 7 List<ResolveInfo> apps = packageManager.queryIntentActivities( 8 resolveIntent, 0); 9 10 ResolveInfo ri = apps.iterator().next(); 11 if (ri != null) { 12 String className = ri.activityInfo.name; 13 14 Intent intent = new Intent(Intent.ACTION_MAIN); 15 intent.addCategory(Intent.CATEGORY_LAUNCHER); 16 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 17 ComponentName cn = new ComponentName(packageName, className); 18 19 intent.setComponent(cn); 20 context.startActivity(intent); 21 } 22 }
标签:android style blog io ar color sp on div
原文地址:http://www.cnblogs.com/l2rf/p/4112944.html