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.idearse.Login.java
public void onBackPressed() { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);/* w ww . j a v a2s. c om*/ }
From source file:org.wso2.cdm.agent.RegistrationActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { Intent i = new Intent(); i.setAction(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_HOME); this.startActivity(i); finish();//from w w w .j a v a2 s.co m return true; } else if (keyCode == KeyEvent.KEYCODE_HOME) { finish(); return true; } return super.onKeyDown(keyCode, event); }
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);//w w w .j a v a 2 s .c om } 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.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: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);/*ww w . jav a 2s. c o 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)/*from w ww. j av a 2 s. 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:leoisasmendi.android.com.suricatepodcast.MainActivity.java
@Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { Log.d(TAG, "onNavigationItemSelected: "); int id = item.getItemId(); Intent intent;/* w w w .java 2 s . com*/ switch (id) { case R.id.menu_main: intent = new Intent(this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); case R.id.menu_search: showSearchFragment(); return true; case R.id.menu_about: showAbout(); return true; case R.id.menu_item_share: Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBodyText = getString(R.string.share_body_text); // TODO: INSERT THE CORRECT URL // sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "www.audiosear.ch/audio.mp3"); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBodyText); startActivity(Intent.createChooser(sharingIntent, "Shearing Option")); return true; case R.id.menu_exit: intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); default: return false; } }
From source file:com.air.mobilebrowser.BrowserActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ttsPlayer = new TTSPlayer(this); // Allow for out-of-band additions to thread queue (mainly for cleanup) mHandler = new Handler(); // Prevents user from taking screenshots. getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // Load layout mWebView = new AIRWebView(this, this); mWebView.requestFocus(View.FOCUS_DOWN); setContentView(R.layout.activity_browser); FrameLayout layout = (FrameLayout) findViewById(R.id.sec_webview); layout.addView(((AIRWebView) mWebView).getLayout()); // Initialize device monitoring mDeviceStatus = new DeviceStatus(this, this); mDeviceStatus.registerReceivers(this); // By default, lock to landscape setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); mDeviceStatus.lockedOrientation = "landscape"; // Configure the webview configureWebView(mWebView);//from w ww .j a v a2 s.com // Configure Debug Console if (mIsDebugEnabled) { findViewById(R.id.slidingDrawer1).setVisibility(View.VISIBLE); findViewById(R.id.addressBarWrapper).setVisibility(View.VISIBLE); findViewById(R.id.goButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String url = ((EditText) findViewById(R.id.address_bar)).getText().toString(); mWebView.loadUrl(url); } }); } // Load the content SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); String url = preferences.getString("pref_default_url", getString(R.string.url_default_location)); // For testing, uncomment the following line to use a custom url: // Check for Internet connectivity if (mDeviceStatus.connectivity == DeviceStatus.CONNECTIVITY_CONNECTED) { mWebView.loadUrl(url); } else { mWebView.loadUrl("about:none"); } // Register BroadcastListener for service intents mSBReceiver = new SBReceiver(this); LocalBroadcastManager.getInstance(super.getApplicationContext()).registerReceiver(mSBReceiver, new IntentFilter(super.getResources().getString(R.string.intent_black_logtag))); LocalBroadcastManager.getInstance(super.getApplicationContext()).registerReceiver(mSBReceiver, new IntentFilter(super.getResources().getString(R.string.intent_micmutechanged))); LocalBroadcastManager.getInstance(super.getApplicationContext()).registerReceiver(mSBReceiver, new IntentFilter(super.getResources().getString(R.string.intent_keyboardchange))); // add receiver for bluetooth keyboard connection/disconnection events LocalBroadcastManager.getInstance(super.getApplicationContext()).registerReceiver(mSBReceiver, new IntentFilter(BluetoothDevice.ACTION_ACL_CONNECTED)); LocalBroadcastManager.getInstance(super.getApplicationContext()).registerReceiver(mSBReceiver, new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECTED)); IntentFilter testFilter = new IntentFilter(Intent.CATEGORY_HOME); super.getApplicationContext().registerReceiver(mSBReceiver, testFilter); // Get AudioManger mAudioManager = (AudioManager) super.getApplicationContext().getSystemService(Context.AUDIO_SERVICE); // Configure JS Command Processing configureJSCmdHandling(); // Begin monitoring for focus change. startService(new Intent(getApplicationContext(), ActivityWatchService.class)); }
From source file:prince.app.sphotos.tools.ActivityX.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override/*w w w . j a v a2 s . c o m*/ public void onBackPressed() { mFinish = mFinish - 1; if (mFinish == 1) Toast.makeText(this, "Press again to exit", Toast.LENGTH_LONG).show(); ; if (mFinish == 0) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }
From source file:io.vit.vitio.StartScreens.FragmentHolder.java
@Override public void onBackPressed() { 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 a2s. co m*/ }