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:com.segma.trim.MainActivity.java
private void exit() { //System.exit(0); 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 . j av a 2s . co m }
From source file:com.zpci.firstsignhairclipdemo.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);//from www . j a va2s . co m showMessage("Hairclip demo 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.sentaroh.android.SMBExplorer.SMBExplorerMain.java
@SuppressWarnings("unused") private void switchToHome() { Intent in = new Intent(); in.setAction(Intent.ACTION_MAIN);/*from www .j a v a 2 s . c o m*/ in.addCategory(Intent.CATEGORY_HOME); in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(in); }
From source file:activities.PaintActivity.java
@Override public void onBackPressed() { if (backButtonCount >= 1) { if (toast != null) toast.cancel();/*from w ww .j a va2s . c om*/ toast = null; Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); backButtonCount = 0; } else { toast = Toast.makeText(this, "Press the back button once again to close the application.", Toast.LENGTH_LONG); toast.show(); backButtonCount++; } }
From source file:com.nbplus.vbroadlauncher.HomeLauncherActivity.java
/** @Override/*from w ww .j ava2s.c o m*/ protected void onNewIntent(Intent intent) { //super.onNewIntent(intent); if (intent == null) { return; } String action = intent.getAction(); Log.d(TAG, "onNewIntent.. action = " + action); // if (PushConstants.ACTION_PUSH_STATUS_CHANGED.equals(action) || PushConstants.ACTION_PUSH_MESSAGE_RECEIVED.equals(action)) { // setPushServiceStatus(intent.getIntExtra(PushConstants.EXTRA_PUSH_STATUS_VALUE, PushConstants.PUSH_STATUS_VALUE_DISCONNECTED)); // // if (mActivityInteractionListener != null) { // for (OnActivityInteractionListener listener : mActivityInteractionListener) { // listener.onPushReceived(intent); // } // } // } } */ protected boolean isMyLauncherDefault() { final IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN); filter.addCategory(Intent.CATEGORY_HOME); List<IntentFilter> filters = new ArrayList<IntentFilter>(); filters.add(filter); final String myPackageName = getPackageName(); List<ComponentName> activities = new ArrayList<ComponentName>(); final PackageManager packageManager = (PackageManager) getPackageManager(); // You can use name of your package here as third argument packageManager.getPreferredActivities(filters, activities, null); for (ComponentName activity : activities) { if (myPackageName.equals(activity.getPackageName())) { return true; } } return false; }
From source file:com.findcab.activity.LocationOverlay.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_BACK) { // exitDialog(context); //??home? Intent intents = new Intent(Intent.ACTION_MAIN); intents.addCategory(Intent.CATEGORY_HOME); intents.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intents);// w w w .j a v a 2 s . com } return super.onKeyDown(keyCode, event); }
From source file:it.chefacile.app.MainActivity.java
@Override public void onBackPressed() { new AlertDialog.Builder(this).setIcon(R.drawable.logo).setTitle("Exit").setMessage("Are you sure?") .setPositiveButton("yes", new DialogInterface.OnClickListener() { @Override/*w ww . j av a 2s. c o m*/ public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);//***Change Here*** startActivity(intent); finish(); System.exit(0); } }).setNegativeButton("no", null).show(); }
From source file:com.example.search.car.pools.welcome.java
public void onBackPressed() { if (canExit) { super.onBackPressed(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);/*from ww w .j a v a 2 s . c om*/ } else { // Fragment fm = getFragmentManager().findFragmentByTag("Search"); if (frag_tag != "Search") { svg_search = SVGParser.getSVGFromResource(welcome.this.getResources(), R.raw.search1); iv_search.setImageDrawable(svg_search.createPictureDrawable()); rlSearch.setBackgroundColor(Color.parseColor("#00ca98")); l_search.setBackground(getResources().getDrawable(R.drawable.white_circle_side_menu)); svg_dashboard = SVGParser.getSVGFromResource(welcome.this.getResources(), R.raw.dashboard); iv_dashboard.setImageDrawable(svg_dashboard.createPictureDrawable()); rlDashboard.setBackgroundColor(Color.parseColor("#2C3E50")); l_dashboard.setBackground(getResources().getDrawable(R.drawable.search_blue)); svg_cities = SVGParser.getSVGFromResource(welcome.this.getResources(), R.raw.city); iv_cities.setImageDrawable(svg_cities.createPictureDrawable()); rlCities.setBackgroundColor(Color.parseColor("#2C3E50")); l_cities.setBackground(getResources().getDrawable(R.drawable.search_blue)); FragmentManager fm = getFragmentManager(); FragmentTransaction fragmentTransaction = fm.beginTransaction(); fragmentTransaction.replace(R.id.content_frame, new Search()); fragmentTransaction.commit(); frag_tag = "Search"; } else { canExit = true; Toast.makeText(getApplicationContext(), "Press again to exit", Toast.LENGTH_SHORT).show(); } } mHandler.sendEmptyMessageDelayed(1, 2000/* time interval to next press in milli second */);// if not // pressed // within // 2 // seconds // then // will // be // setted(canExit) // as // false }
From source file:com.dsdar.thosearoundme.TeamViewActivity.java
@Override public void onBackPressed() { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setTitle("Exit Application?"); alertDialogBuilder.setMessage("Click yes to exit!").setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Remove Service stopService(new Intent(getBaseContext(), LocationUpdates.class)); // stopService(new Intent(getBaseContext(), // LocationService.class)); if (itsLocationUpdates != null) itsLocationUpdates.disconnectLocationClient(); mHandlerTaskServiceStop = new Runnable() { @Override public void run() { Log.d("tmf", "calling mHandlerTaskServiceStop......."); // Get and set team members location in // map // finish(); // moveTaskToBack(true); // // Intent amyProfileIntent = new Intent().setClass( // TeamViewActivity.this, WelcomeActivity.class); // startActivity(amyProfileIntent); // // // android.os.Process // .killProcess(android.os.Process // .myPid()); // System.exit(1); 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 .j a va 2s . c o m*/ }; itsHandlerServiceStop.postDelayed(mHandlerTaskServiceStop, 1500); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); }
From source file:com.android.launcher3.Utilities.java
private static void applyChange(Activity context) { context.finish();//from w w w. ja va2s .com context.startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER) .addCategory(Intent.CATEGORY_DEFAULT).addCategory(Intent.CATEGORY_HOME)); }