List of usage examples for android.content Intent CATEGORY_HOME
String CATEGORY_HOME
To view the source code for android.content Intent CATEGORY_HOME.
Click Source Link
From source file:org.zywx.wbpalmstar.engine.EBrowserActivity.java
public final void exitBrowser() { if (mSipBranch) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addCategory(Intent.CATEGORY_HOME); startActivity(intent);//www . j a v a 2 s. c o m return; } if (null != mBrowser) { mBrowser.onAppStop(); } mBrowserAround.removeViewImmediate(); clean(); finish(); }
From source file:com.linkbubble.util.Util.java
static public String getDefaultLauncherPackage(PackageManager packageManager) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); ResolveInfo resolveInfo = packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); if (resolveInfo != null && resolveInfo.activityInfo != null) { if (resolveInfo.activityInfo.packageName.equals("android") == false) { //setDefaultLauncherPreference.setSummary(R.string.not_default_youtube_app); return resolveInfo.activityInfo.packageName; }/* w w w . ja v a2 s. c o m*/ } return null; }
From source file:com.first.akashshrivastava.showernow.ShowerActivity.java
@Override public void onBackPressed() { //if back is pressed the application closes Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);/*from w w w. ja va2s . c o m*/ }
From source file:com.pvo.activity.MainFragmentActivity.java
@Override public void onBackPressed() { if (fragmentStack.size() > 1) { System.out.println("--> On back press if condition <---"); FragmentTransaction ft = fragmentManager.beginTransaction(); if (ft != null) { fragmentStack.lastElement().onPause(); ft.remove(fragmentStack.pop()); Fragment lastFragment = fragmentStack.lastElement(); lastFragment.onResume();/*from w ww . j a v a 2 s . co m*/ ft.show(lastFragment); ft.commit(); } } else { System.out.println("--> On back press else condition <---"); Fragment visible = getVisibleFragment(); if (visible instanceof ZNotificationMainFragment) { clearStoreData(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { redirectToNotificaiton(); } } }
From source file:com.fbbackup.MyFriendFragmentActivity.java
/** * }app//from ww w.j a v a 2 s . c o m */ public void exit() { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); }
From source file:com.etime.ETimeActivity.java
/** * Callback for pressing the back button. Used to prevent the app * from destroying it self if the back button is pressed to go to * previous app/homescreen./* w w w . j a va 2 s .c o m*/ */ @Override public void onBackPressed() { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(activity); if (pref.getBoolean(getString(R.string.keepInBackground), true)) { Intent setIntent = new Intent(Intent.ACTION_MAIN); setIntent.addCategory(Intent.CATEGORY_HOME); setIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(setIntent); } else { super.onBackPressed(); } }
From source file:com.air.mobilebrowser.BrowserActivity.java
/** * Determine if the application is set as the default * home./* w w w.j a va2 s . c o m*/ * @return true if the default home package is the secure browser, false * otherwise. */ public boolean validateHomePackage() { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); PackageManager pm = getPackageManager(); final ResolveInfo mInfo = pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); String homePackage = mInfo.activityInfo.packageName; return homePackage.equals(getPackageName()); }
From source file:com.example.lilach.alsweekathon_new.MainActivity.java
@Override public void onBackPressed() { if (mState == UART_PROFILE_CONNECTED) { Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(startMain);// ww w . j ava 2 s. c om showMessage("nRFUART's running in background.\n Disconnect to exit"); } else { new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert).setTitle(R.string.popup_title) .setMessage(R.string.popup_message) .setPositiveButton(R.string.popup_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }).setNegativeButton(R.string.popup_no, null).show(); } }
From source file:com.smithdtyler.prettygoodmusicplayer.NowPlaying.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { Intent intent = new Intent(NowPlaying.this, SettingsActivity.class); startActivity(intent);//from w ww. ja v a 2 s .co m return true; } if (id == R.id.action_exit) { Intent broadcastIntent = new Intent(); broadcastIntent.setAction("com.smithdtyler.ACTION_EXIT"); sendBroadcast(broadcastIntent); Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(startMain); finish(); return true; } if (id == android.R.id.home) { onBackPressed(); return true; } return super.onOptionsItemSelected(item); }
From source file:org.wso2.iot.agent.activities.AlreadyRegisteredActivity.java
/** * Load device home screen.// w w w .ja v a 2 s. c om */ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) private void loadHomeScreen() { if (!devicePolicyManager.isProfileOwnerApp(getPackageName())) { finish(); Intent i = new Intent(); i.setAction(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_HOME); this.startActivity(i); super.onBackPressed(); } else { Toast.makeText(this, "Press Home Button to exit.", Toast.LENGTH_SHORT).show(); } }