List of usage examples for android.content Intent FLAG_ACTIVITY_CLEAR_TOP
int FLAG_ACTIVITY_CLEAR_TOP
To view the source code for android.content Intent FLAG_ACTIVITY_CLEAR_TOP.
Click Source Link
From source file:com.android.dialer.calllog.CallLogActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: final Intent intent = new Intent(this, DialtactsActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);//w ww . ja v a 2s . c o m return true; case R.id.delete_all: ClearCallLogDialog.show(getFragmentManager()); return true; } return super.onOptionsItemSelected(item); }
From source file:com.androzic.MainActivity.java
@SuppressLint({ "ShowToast", "NewApi" }) @Override//from w w w.j a va 2 s.co m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.e(TAG, "onCreate()"); if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build()); application = Androzic.getApplication(); // check if called after crash if (!application.mapsInited) { restarting = true; startActivity(new Intent(this, Splash.class) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK) .putExtras(getIntent())); finish(); return; } setContentView(R.layout.activity_main); mToolbar = (Toolbar) findViewById(R.id.action_toolbar); setSupportActionBar(mToolbar); mActionButton = (FloatingActionButton) findViewById(R.id.toolbar_action_button); backToast = Toast.makeText(this, R.string.backQuit, Toast.LENGTH_SHORT); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); onSharedPreferenceChanged(settings, getString(R.string.pref_exit)); onSharedPreferenceChanged(settings, getString(R.string.pref_hidestatusbar)); onSharedPreferenceChanged(settings, getString(R.string.pref_orientation)); settings.registerOnSharedPreferenceChangeListener(this); mTitle = mDrawerTitle = getTitle(); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // set up the drawer's list view with items and click listener mDrawerItems = new ArrayList<>(); mDrawerList = (ListView) findViewById(R.id.left_drawer); mDrawerAdapter = new DrawerAdapter(this, mDrawerItems); mDrawerList.setAdapter(mDrawerAdapter); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); initializeDrawerItems(); mCoordinatorLayout = (CoordinatorLayout) findViewById(R.id.main_content); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); mHomeDrawable = getDrawerToggleDelegate().getThemeUpIndicator(); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.drawer_open, R.string.drawer_close) { public void onDrawerClosed(View drawerView) { if (drawerView == mDrawerList) { getSupportActionBar().setTitle(mTitle); supportInvalidateOptionsMenu(); } } public void onDrawerOpened(View drawerView) { if (drawerView == mDrawerList) { getSupportActionBar().setTitle(mDrawerTitle); supportInvalidateOptionsMenu(); } } }; mDrawerLayout.setDrawerListener(mDrawerToggle); getSupportFragmentManager().addOnBackStackChangedListener(mBackStackChangedListener); if (savedInstanceState == null) { mDrawerAdapter.setSelectedItem(-1); selectItem(0); } }
From source file:com.notifry.android.SourceList.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent intent = new Intent(this, ChooseAccount.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);/*from ww w . java 2 s . c om*/ return true; case ADD_SOURCE: askForSourceName(); return true; case REFRESH_SERVER: syncWithServer(); return true; } return super.onOptionsItemSelected(item); }
From source file:com.aqnote.app.wifianalyzer.MainActivity.java
private void reloadActivity() { finish();//from w w w . j av a2s . c o m Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); }
From source file:edu.mines.letschat.GcmIntentService.java
protected PendingIntent getDeleteIntent() { Intent resultBroadCastIntent = new Intent(); resultBroadCastIntent.setAction("deletion"); resultBroadCastIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); resultBroadCastIntent.addCategory(Intent.CATEGORY_DEFAULT); sendBroadcast(resultBroadCastIntent); return PendingIntent.getBroadcast(getBaseContext(), 0, resultBroadCastIntent, PendingIntent.FLAG_CANCEL_CURRENT); }
From source file:com.newtifry.android.SourceList.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish();//from www. j a v a2s . com /* Intent intent = new Intent(this, ChooseAccount.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); */ return true; case ADD_SOURCE: askForSourceName(); return true; case REFRESH_SERVER: syncWithServer(); return true; case PREFERENCES_MENU_ID: Intent intent = new Intent(this, NewtifryPreferenceActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); return true; } return super.onOptionsItemSelected(item); }
From source file:com.app.imagecreator.activities.HomeActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.linGallary: Utility.loadFromGallary(this); break;//w w w.ja v a 2 s.c om case R.id.linCamera: loadFromCamera(); break; case R.id.linPaint: Intent intent = new Intent(HomeActivity.this, DrawaingActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); break; case R.id.linRateMe: //Utility.rateMe(this); if (billingProcessor.isPurchased(PRODUCT_ID)) { Utility.rateMe(this); } else { //new SettingDialog(this).show(); showSettingsDialog(); } break; default: break; } }
From source file:com.manning.androidhacks.hack040.ImageDetailActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // Home or "up" navigation final Intent intent = new Intent(this, ImageGridActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);/*from w w w .j a v a 2 s. c o m*/ return true; case R.id.clear_cache: final ImageCache cache = mImageWorker.getImageCache(); if (cache != null) { mImageWorker.getImageCache().clearCaches(); // DiskLruCache.clearCache(this, ImageFetcher.HTTP_CACHE_DIR); Toast.makeText(this, R.string.clear_cache_complete, Toast.LENGTH_SHORT).show(); } return true; } return super.onOptionsItemSelected(item); }
From source file:com.android.contacts.activities.ContactDetailActivity.java
/** @} */ @Override//from w w w . j a v a 2 s. co m protected void onCreate(Bundle savedState) { super.onCreate(savedState); LogUtils.i(TAG, "[onCreate][launch]start"); ///M: Bug Fix for ALPS01022809,JE happens when click the favourite video to choose contact in tablet registerPHBReceiver(); mIsActivitFinished = false; /** M: Bug Fix for ALPS00393950 @{ */ boolean isUsingTwoPanes = PhoneCapabilityTester.isUsingTwoPanes(this); if (!isUsingTwoPanes) { SetIndicatorUtils.getInstance().registerReceiver(this); } /** @} */ if (PhoneCapabilityTester.isUsingTwoPanes(this)) { // This activity must not be shown. We have to select the contact in the // PeopleActivity instead ==> Create a forward intent and finish final Intent originalIntent = getIntent(); Intent intent = new Intent(); intent.setAction(originalIntent.getAction()); intent.setDataAndType(originalIntent.getData(), originalIntent.getType()); // If we are launched from the outside, we should create a new task, because the user // can freely navigate the app (this is different from phones, where only the UP button // kicks the user into the full app) if (shouldUpRecreateTask(intent)) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); } else { intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_FORWARD_RESULT | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); } intent.setClass(this, PeopleActivity.class); startActivity(intent); LogUtils.i(TAG, "onCreate(),Using Two Panes...finish Actiivity.."); finish(); return; } setContentView(R.layout.contact_detail_activity); mContactDetailLayoutController = new ContactDetailLayoutController(this, savedState, getFragmentManager(), null, findViewById(R.id.contact_detail_container), mContactDetailFragmentListener); // We want the UP affordance but no app icon. // Setting HOME_AS_UP, SHOW_TITLE and clearing SHOW_HOME does the trick. ActionBar actionBar = getActionBar(); if (actionBar != null) { ///@Modify for add Customer view{ actionBar.setDisplayOptions( ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM); ///@} actionBar.setTitle(""); } Log.i(TAG, getIntent().getData().toString()); /** M: New Feature xxx @{ */ //M:fix CR:ALPS00958663,disconnect to smartbook when contact screen happen JE if (getIntent() != null && getIntent().getData() != null) { mSimOrPhoneUri = getIntent().getData(); Log.i(TAG, "mSimOrPhoneUri = " + mSimOrPhoneUri); } else { Log.e(TAG, "Get intent data error getIntent() = " + getIntent()); } /// M: @ CT contacts detail history set listener{ ExtensionManager.getInstance().getContactDetailEnhancementExtension().configActionBarExt(getActionBar(), ContactPluginDefault.COMMD_FOR_OP09); /// @} LogUtils.i(TAG, "[onCreate][launch]end"); }