List of usage examples for android.content Intent ACTION_MAIN
String ACTION_MAIN
To view the source code for android.content Intent ACTION_MAIN.
Click Source Link
From source file:com.oakesville.mythling.MediaPagerActivity.java
@Override public void onBackPressed() { if (EpgActivity.class.getName().equals(backTo) || FireTvEpgActivity.class.getName().equals(backTo)) { Intent a = new Intent(Intent.ACTION_MAIN); a.addCategory(Intent.CATEGORY_HOME); a.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(a);/*from www. ja v a 2 s . c o m*/ } else if (modeSwitch) { modeSwitch = false; Intent intent = new Intent(this, MediaPagerActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); } else { super.onBackPressed(); } }
From source file:com.digitalarx.android.ui.activity.FileDisplayActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Log_OC.d(TAG, "onCreate() start"); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); // this calls onAccountChanged() when ownCloud Account is valid // PIN CODE request ; best location is to decide, let's try this first if (getIntent().getAction() != null && getIntent().getAction().equals(Intent.ACTION_MAIN) && savedInstanceState == null) { requestPinCode();/*from w ww .j a v a2s. c om*/ } else if (getIntent().getAction() == null && savedInstanceState == null) { requestPinCode(); } /// grant that FileObserverService is watching favourite files if (savedInstanceState == null) { Intent initObserversIntent = FileObserverService.makeInitIntent(this); startService(initObserversIntent); } /// Load of saved instance state if (savedInstanceState != null) { mWaitingToPreview = (OCFile) savedInstanceState .getParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW); mSyncInProgress = savedInstanceState.getBoolean(KEY_SYNC_IN_PROGRESS); mWaitingToSend = (OCFile) savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_SEND); //mauz added isSyncServiceStarted = savedInstanceState.getBoolean(IS_SYNC_SERVICE_STARTED); } else { mWaitingToPreview = null; mSyncInProgress = false; mWaitingToSend = null; } /// USER INTERFACE // Inflate and set the layout view setContentView(R.layout.files); mDualPane = getResources().getBoolean(R.bool.large_land_layout); mLeftFragmentContainer = findViewById(R.id.left_fragment_container); mRightFragmentContainer = findViewById(R.id.right_fragment_container); if (savedInstanceState == null) { createMinFragments(); } // Action bar setup mDirectories = new CustomArrayAdapter<String>(this, R.layout.sherlock_spinner_dropdown_item); getSupportActionBar().setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/); // always AFTER setContentView(...) ; to work around bug in its implementation Log_OC.d(TAG, "onCreate() end"); }
From source file:com.adguard.android.commons.BrowserUtils.java
public static void startYandexBrowser(Context context) { ComponentName componentName = getYandexBrowser(context, Intent.ACTION_MAIN); if (componentName != null) { startBrowser(context, componentName); }/*from w w w .j a va 2 s . com*/ }
From source file:com.notepadlite.MainActivity.java
private void checkForAndroidWear() { // Notepad Plugin for Android Wear sends intent with "plugin_install_complete" extra, // in order to verify that the main Notepad app is installed correctly if (getIntent().hasExtra("plugin_install_complete")) { if (getSupportFragmentManager().findFragmentByTag("WearPluginDialogFragmentAlt") == null) { DialogFragment wearDialog = new WearPluginDialogFragmentAlt(); wearDialog.show(getSupportFragmentManager(), "WearPluginDialogFragmentAlt"); }//from w ww. j a v a 2 s. c o m SharedPreferences pref = getSharedPreferences(getPackageName() + "_preferences", Context.MODE_PRIVATE); SharedPreferences.Editor editor = pref.edit(); editor.putBoolean("show_wear_dialog", false); editor.apply(); } else { boolean hasAndroidWear = false; @SuppressWarnings("unused") PackageInfo pInfo; try { pInfo = getPackageManager().getPackageInfo("com.google.android.wearable.app", 0); hasAndroidWear = true; } catch (PackageManager.NameNotFoundException e) { } if (hasAndroidWear) { try { pInfo = getPackageManager().getPackageInfo("com.notepadlite.wear", 0); Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(ComponentName .unflattenFromString("com.notepadlite.wear/com.notepadlite.wear.MobileMainActivity")); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } catch (PackageManager.NameNotFoundException e) { SharedPreferences pref = getSharedPreferences(getPackageName() + "_preferences", Context.MODE_PRIVATE); if (pref.getBoolean("show_wear_dialog", true) && getSupportFragmentManager().findFragmentByTag("WearPluginDialogFragment") == null) { DialogFragment wearDialog = new WearPluginDialogFragment(); wearDialog.show(getSupportFragmentManager(), "WearPluginDialogFragment"); } } catch (ActivityNotFoundException e) { } } } }
From source file:com.shipdream.lib.android.mvc.view.BaseTestCase.java
protected void pressHome() { Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); activity.startActivity(startMain); }
From source file:com.abhinavjhanwar.android.egg.neko.Cat.java
public NotificationCompat.Builder buildNotificationbelowM(Context context) { final Bundle extras = new Bundle(); extras.putString("android.substName", context.getString(R.string.app_name)); final Intent intent = new Intent(Intent.ACTION_MAIN).setClass(context, NekoLand.class) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); return new NotificationCompat.Builder(context).setSmallIcon(R.drawable.stat_icon) .setContentTitle(OldService.notificationText).setContentText(getName()) .setContentIntent(PendingIntent.getActivity(context, 0, intent, 0)).setAutoCancel(true) .setVibrate(PURR);/* www. j av a2s . co m*/ }
From source file:com.android.launcher3.InstallShortcutReceiver.java
/** * Returns true if the intent is a valid launch intent for a shortcut. * This is used to identify shortcuts which are different from the ones exposed by the * applications' manifest file.//w w w.j a v a2 s .co m * * When DISABLE_ALL_APPS is true, shortcuts exposed via the app's manifest should never be * duplicated or removed(unless the app is un-installed). * * @param launchIntent The intent that will be launched when the shortcut is clicked. */ static boolean isValidShortcutLaunchIntent(Intent launchIntent) { if (launchIntent != null && Intent.ACTION_MAIN.equals(launchIntent.getAction()) && launchIntent.getComponent() != null && launchIntent.getCategories() != null && launchIntent.getCategories().size() == 1 && launchIntent.hasCategory(Intent.CATEGORY_LAUNCHER) && launchIntent.getExtras() == null && TextUtils.isEmpty(launchIntent.getDataString())) { return false; } return true; }
From source file:org.wso2.iot.agent.activities.PinCodeActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && AlreadyRegisteredActivity.class.getSimpleName().equals(fromActivity)) { Intent intent = new Intent(PinCodeActivity.this, AlreadyRegisteredActivity.class); intent.putExtra(getResources().getString(R.string.intent_extra_from_activity), PinCodeActivity.class.getSimpleName()); intent.putExtra(getResources().getString(R.string.intent_extra_regid), registrationId); startActivity(intent);/*from w ww . ja v a 2s . co m*/ finish(); return true; } else if (keyCode == KeyEvent.KEYCODE_BACK) { Intent i = new Intent(); i.setAction(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_HOME); startActivity(i); finish(); return true; } return super.onKeyDown(keyCode, event); }
From source file:com.farmerbb.taskbar.activity.HomeActivity.java
@SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.N)//w ww . j a v a 2s. com @Override protected void onResume() { super.onResume(); if (bootToFreeform()) { if (U.launcherIsDefault(this)) { U.startFreeformHack(this, false, false); } else { U.showToastLong(this, R.string.set_as_default_home); Intent homeIntent = new Intent(Intent.ACTION_MAIN); homeIntent.addCategory(Intent.CATEGORY_HOME); homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try { startActivity(homeIntent); finish(); } catch (ActivityNotFoundException e) { /* Gracefully fail */ } } } else { LocalBroadcastManager.getInstance(this) .sendBroadcast(new Intent("com.farmerbb.taskbar.TEMP_SHOW_TASKBAR")); } }
From source file:com.adguard.android.commons.BrowserUtils.java
public static void startBrowser(Context context, ComponentName component) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setComponent(component);/* ww w . ja v a2 s . c om*/ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }