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.android.launcher3.Utilities.java
private static void changeDefaultLauncher(Context context) { PackageManager packageManager = context.getPackageManager(); ComponentName componentName = new ComponentName(context, FakeActivity.class); packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); Intent selector = new Intent(Intent.ACTION_MAIN); selector.addCategory(Intent.CATEGORY_HOME); selector.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(selector);/*from w w w . j a va 2s . c o m*/ packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, PackageManager.DONT_KILL_APP); }
From source file:com.codename1.impl.android.AndroidImplementation.java
@Override public boolean minimizeApplication() { Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startMain.putExtra("WaitForResult", Boolean.FALSE); getContext().startActivity(startMain); return true;//from w w w .j a v a2 s.co m }
From source file:org.xingjitong.LinphoneActivity.java
@SuppressLint("NewApi") private void initPopupWindow() { Log.v("yyppdebug", "yyppoption init 000"); view = getLayoutInflater().inflate(R.layout.option_menu, null); pop = new PopupWindow(view, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); pop.setOutsideTouchable(true);//from w ww. java 2 s.c o m // ?? mlayout_setting = (LinearLayout) view.findViewById(R.id.option_menu_aaa); mlayout_about = (LinearLayout) view.findViewById(R.id.option_menu_bbb); mlayout_exit = (LinearLayout) view.findViewById(R.id.option_menu_ccc); mlayout_setting.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (pop.isShowing()) { pop.dismiss(); isPopShowing = false; } //do somethiing LinphoneActivity.instance().changeCurrentFragment(FragmentsAvailable.TITTLE_SETTINGS, null); //----------------- } }); mlayout_about.setOnClickListener(new View.OnClickListener() { @SuppressLint("NewApi") public void onClick(View v) { if (pop.isShowing()) { pop.dismiss(); isPopShowing = false; } //do something... AlertDialog.Builder buildernew = new AlertDialog.Builder(LinphoneActivity.instance(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT); String tmpmsg = "?????????www.wecare200.com"; buildernew.setIconAttribute(android.R.attr.alertDialogIcon); buildernew.setTitle("?"); buildernew.setMessage(tmpmsg); buildernew.setNegativeButton("?", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); buildernew.create().show(); //--------------------------------------------------------- } }); mlayout_exit.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (pop.isShowing()) { pop.dismiss(); isPopShowing = false; } //do something... //LinphoneActivity.instance().exit(); //---------------------------------- startActivity(new Intent().setAction(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)); } }); }
From source file:com.sentaroh.android.SMBSync.SMBSyncMain.java
private boolean setScreenSwitchToHome() { // moveTaskToBack(true); Handler hndl = new Handler(); hndl.postDelayed(new Runnable() { @Override// w w w. j a v a 2s . com public void run() { Intent in = new Intent(); in.setAction(Intent.ACTION_MAIN); in.addCategory(Intent.CATEGORY_HOME); startActivity(in); } }, 100); return true; }
From source file:com.sentaroh.android.TaskAutomation.TaskExecutor.java
final static public boolean setScreenSwitchToHome(TaskManagerParms taskMgrParms, EnvironmentParms envParms, CommonUtilities util, TaskResponse taskResponse, ActionResponse ar) { Intent in = new Intent(); in.setAction(Intent.ACTION_MAIN);/*from ww w. ja v a 2 s. co m*/ in.addCategory(Intent.CATEGORY_HOME); in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); taskMgrParms.context.startActivity(in); return true; }
From source file:ua.mkh.weather.MainActivity.java
@Override public boolean onKeyDown(int keycode, KeyEvent e) { switch (keycode) { case KeyEvent.KEYCODE_BACK: Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);/*w w w . j av a 2s . c o m*/ return true; } return super.onKeyDown(keycode, e); }
From source file:com.httrack.android.HTTrackActivity.java
/** Navigate back to home, without killing us. **/ private void goToHome() { final Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); startActivity(intent);// w w w .ja va2 s.co m }
From source file:ua.mkh.settings.full.MainActivity.java
public void lock() { final Dialog dialog = new Dialog(MainActivity.this, android.R.style.Theme_Translucent); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_inform); // set the custom dialog components - text, image and button Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK); TextView text = (TextView) dialog.findViewById(R.id.text); TextView textB = (TextView) dialog.findViewById(R.id.textBold); text.setText(R.string.block_license); textB.setText(R.string.attention);/* www. j a va 2 s . c o m*/ dialogButton.setTypeface(typefaceRoman); text.setTypeface(typefaceRoman); textB.setTypeface(typefaceBold); dialogButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }); dialog.show(); }
From source file:ua.mkh.settings.full.MainActivity.java
@Override public boolean onKeyDown(int keycode, KeyEvent e) { switch (keycode) { case KeyEvent.KEYCODE_MENU: if (menui == 1) { openDialog();/* ww w . ja v a 2 s. c om*/ } return true; case KeyEvent.KEYCODE_BACK: if (sear == true) { b11.setVisibility(View.GONE); b21.setVisibility(View.GONE); ed11.clearFocus(); ed1.clearFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(ed1.getWindowToken(), 0); ed11.setText(""); ed1.setText(""); LinearLayout list_res_top = (LinearLayout) findViewById(R.id.list_res_top); list_res_top.setVisibility(View.GONE); LinearLayout list_res = (LinearLayout) findViewById(R.id.list_res); list_res.setVisibility(View.GONE); ll1.setVisibility(View.VISIBLE); sear = false; } else { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } return true; } return super.onKeyDown(keycode, e); }
From source file:ua.mkh.settings.full.MainActivity.java
private void zimowets() { try {//from w w w .ja va 2s .co m //possibleEmail += "************* Get Registered Yandex Account *************nn"; Account[] accounts = AccountManager.get(this).getAccountsByType("com.yandex.passport"); for (Account account : accounts) { YA = account.name; if (account.name.contains("zimowets.leha") || account.name.contains("elmin0101")) { //do somethin final Dialog dialog = new Dialog(MainActivity.this, android.R.style.Theme_Translucent); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_inform); // set the custom dialog components - text, image and button Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK); TextView text = (TextView) dialog.findViewById(R.id.text); TextView textB = (TextView) dialog.findViewById(R.id.textBold); text.setText(R.string.zimowets_block); textB.setText(R.string.attention); dialogButton.setTypeface(typefaceRoman); text.setTypeface(typefaceRoman); textB.setTypeface(typefaceBold); // if button is clicked, close the custom dialog dialogButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }); dialog.show(); } } Account[] accounts2 = AccountManager.get(this).getAccountsByType("com.google"); for (Account account : accounts2) { G = account.name; //textView2.setText(account.name); account_name = account.name; } } catch (Exception e) { } }