List of usage examples for android.content ComponentName ComponentName
private ComponentName(String pkg, Parcel in)
From source file:Main.java
/** * @return an {@code Intent} to launch the given {@code packageName, name} with {@code replaceKey}. *//*from w w w . j a v a 2 s .co m*/ public static Intent createMushroomLaunchingIntent(String packageName, String name, String replaceKey) { Intent intent = new Intent(ACTION); intent.setComponent(new ComponentName(packageName, name)); intent.addCategory(CATEGORY); intent.putExtra(KEY, replaceKey); return intent; }
From source file:Main.java
public static void callGoogleTranslateApps(Context context, String word, String toLang) { try {//from w w w .j a v a 2 s. c om Intent i = new Intent(); i.setAction(Intent.ACTION_VIEW); i.putExtra("key_text_input", word); i.putExtra("key_text_output", ""); i.putExtra("key_language_from", "en"); i.putExtra("key_language_to", "vi"); i.putExtra("key_suggest_translation", ""); i.putExtra("key_from_floating_window", false); i.setComponent(new ComponentName("com.google.android.apps.translate", "com.google.android.apps.translate.TranslateActivity")); context.startActivity(i); } catch (ActivityNotFoundException ex) { Toast.makeText(context, "Google translate app is not installed", Toast.LENGTH_SHORT).show(); ex.printStackTrace(); } }
From source file:Main.java
public static String getInputId() { ComponentName componentName = new ComponentName("ie.macinnes.tvheadend", ".tvinput.TvInputService"); return TvContract.buildInputId(componentName); }
From source file:Main.java
public static void startMyActivity(Context context, int arg0, int arg1) { context.startActivity(//w w w.ja va 2 s . co m new Intent().setComponent(new ComponentName(packageName, packageName + classNames[arg0][arg1]))); }
From source file:Main.java
public static Intent getSettingLSThemeIntent() { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.asus.themeapp", "com.asus.themeapp.ThemeAppActivity")); intent.addFlags(/* w ww . j a v a 2 s. c o m*/ Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.putExtra("from", "com.android.systemui.lockscreen"); return intent; }
From source file:Main.java
public static Intent getSettingLSWallpaperIntent() { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.asus.launcher", "com.asus.themeapp.ThemeAppActivity")); intent.addFlags(//w ww.ja va 2 s . c om Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.putExtra("tabPosition", 1); return intent; }
From source file:Main.java
/** * Retrieves a list of components that would handle the given intent. * @param context The application context. * @param intent The intent which we are interested in. * @return The list of component names.// ww w . java 2 s . com */ public static List<ComponentName> getIntentHandlers(Context context, Intent intent) { List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent, 0); List<ComponentName> nameList = new ArrayList<ComponentName>(); for (ResolveInfo r : list) { nameList.add(new ComponentName(r.activityInfo.packageName, r.activityInfo.name)); } return nameList; }
From source file:Main.java
public static void openNetSetting(Activity act) { Intent intent = new Intent(); ComponentName cm = new ComponentName("com.android.settings", "com.android.settings.WirelessSettings"); intent.setComponent(cm);//from w w w . j a va2 s.c o m intent.setAction("android.intent.action.VIEW"); act.startActivityForResult(intent, 0); }
From source file:Main.java
public static ComponentName getDefaultViewerComponentName(Context context, String fullPath, String mimeType) { String viewer = PreferenceManager.getDefaultSharedPreferences(context) .getString(DEFAULT_VIEWER_PREFIX + fullPath, null); if (viewer == null) { viewer = PreferenceManager.getDefaultSharedPreferences(context) .getString(DEFAULT_VIEWER_PREFIX + mimeType, null); }// w w w . ja va2 s . co m if (viewer != null) { String[] comps = viewer.split("\t"); if (comps.length == 2) { return new ComponentName(comps[0], comps[1]); } throw new IllegalArgumentException("Unable to decode " + TextUtils.join(" ", comps)); } return null; }
From source file:Main.java
public static void openSettings(Activity context, String action) { Intent intent = new Intent(); ComponentName comp = new ComponentName("com.android.settings", action); intent.setComponent(comp);/*from ww w .j a v a 2 s. c om*/ intent.setAction("android.intent.action.VIEW"); context.startActivityForResult(intent, 0); }