List of usage examples for android.content Intent FLAG_ACTIVITY_CLEAR_TASK
int FLAG_ACTIVITY_CLEAR_TASK
To view the source code for android.content Intent FLAG_ACTIVITY_CLEAR_TASK.
Click Source Link
From source file:com.oakesville.mythling.MediaListActivity.java
@Override public void onBackPressed() { if (modeSwitch) { modeSwitch = false;/* w w w .j a v a 2 s . c o m*/ Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); } else { super.onBackPressed(); } }
From source file:org.creativecommons.thelist.activities.StartActivity.java
@Override protected void onRestart() { super.onRestart(); Log.v(TAG, "ON RESTART CALLED"); if (!(mCurrentUser.isTempUser())) { Log.v(TAG, "ONRESTART: USER IS LOGGED IN"); Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent);// w w w . ja v a 2s . c o m } else { Log.v(TAG, "ONRESTART: USER IS NOT LOGGED IN"); } Log.v(TAG, "ON RESTART CALLED AFTER START MAIN INTENT"); }
From source file:com.onegini.mobile.exampleapp.view.activity.SettingsActivity.java
private void userDeregistered() { new DeregistrationUtil(this).onUserDeregistered(authenticatedUserProfile); final Intent intent = new Intent(this, LoginActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent);//from w w w . java2 s. co m finish(); }
From source file:com.appteam.nimbus.activity.homeActivity.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(); //noinspection SimplifiableIfStatement if (id == R.id.action_logout) { personalData.SaveData(false);/*from www.jav a2 s . co m*/ Intent launch_logout = new Intent(homeActivity.this, Login.class); launch_logout.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); launch_logout.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); launch_logout.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(launch_logout); finish(); return true; } else if (id == R.id.action_leaderboard) { startActivity(new Intent(homeActivity.this, Leaderboard.class)); return true; } else if (id == R.id.action_important_contact) { CharSequence name[] = { "Ankush Sharma\n(Discipline Secretary)", "Rishabh Kumar\n(Discipline Joint Secretary)", "Kumud Jindal\n(Discipline Joint Secretary)", }; final CharSequence number[] = { "9736688292", "8627090570", "9882263949" }; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setIcon(android.R.drawable.ic_menu_call); builder.setTitle("Emergency Contact"); builder.setItems(name, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:+91" + number[i])); startActivity(intent); } }); AlertDialog alertDialog = builder.create(); alertDialog.show(); } return super.onOptionsItemSelected(item); }
From source file:org.creativecommons.thelist.activities.RandomActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_random); mContext = this; mRequestMethods = new RequestMethods(mContext); mSharedPref = new SharedPreferencesMethods(mContext); mMessageHelper = new MessageHelper(mContext); mCurrentUser = new ListUser(RandomActivity.this); //Google Analytics Tracker ((ListApplication) getApplication()).getTracker(ListApplication.TrackerName.GLOBAL_TRACKER); mItemList = new ArrayList<>(); //UI Elements mBackground = (RelativeLayout) findViewById(R.id.random_item_background); mTextView = (TextView) findViewById(R.id.random_item_text); mProgressBar = (ProgressBar) findViewById(R.id.progressBar); mDoneButton = (Button) findViewById(R.id.doneButton); mYesButton = (ImageButton) findViewById(R.id.YesButton); mNoButton = (ImageButton) findViewById(R.id.NoButton); //ImageButton CameraButton = (ImageButton) findViewById(R.id.CameraButton); mRequestMethods.getRandomItems(new RequestMethods.ResponseCallback() { @Override/*from ww w . j av a2s . co m*/ public void onSuccess(JSONArray response) { Log.v(TAG, "> getRandomListItems > onSuccess: " + response); mRandomItemData = response; updateView(); } @Override public void onFail(VolleyError error) { Log.d(TAG, "> getRandomListItems > onFail: " + error.getMessage()); mMessageHelper.noItemsFound(); //TODO: Take user elsewhere if items dont load } }); //Add list item to my list mYesButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Add items to ItemList MainListItem listItem = new MainListItem(); listItem.setItemID(mItemID); listItem.setItemName(mItemName); listItem.setMakerName(mMakerName); listItem.setCategoryID(mCategoryID); mItemList.add(listItem); //Toast: Confirm List Item has been added //TODO: add this to addItemToUserList callback final Toast toast = Toast.makeText(RandomActivity.this, "Added to Your List", Toast.LENGTH_SHORT); toast.show(); new android.os.Handler().postDelayed(new Runnable() { @Override public void run() { toast.cancel(); } }, 1000); //If logged in, add item to users list right away if (!(mCurrentUser.isTempUser())) { Log.v(TAG, "> isTempUser, user is logged in"); mCurrentUser.addItemToUserList(mItemID); } //Display a new item updateView(); //show doneButton if user has selected at least 3 items if (mItemList.size() == 1) { //once it has 3 items mDoneButton.setVisibility(View.VISIBLE); } } //OnClick }); //YesButton.setOnClickListener //Decline adding list item to my list mNoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { updateView(); if (itemPositionCount >= 1 && mDoneButton.getVisibility() == View.INVISIBLE) { mDoneButton.setVisibility(View.VISIBLE); } } }); //Im done with picking items mDoneButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Get array of selected item IDS if (mCurrentUser.isTempUser()) { saveTempUserItems(); } //Clear ItemList mItemList.clear(); Intent intent = new Intent(mContext, DrawerActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); } }); //Done Button }
From source file:nl.dobots.fridgefile.FridgeFile.java
private void createAlertNotification(String notificationSmall, String notificationBig) { Intent contentIntent = new Intent(this, MainActivity.class); contentIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); PendingIntent piContent = PendingIntent.getActivity(this, 0, contentIntent, PendingIntent.FLAG_UPDATE_CURRENT); _notificationBuilder = new NotificationCompat.Builder(this).setSmallIcon(R.mipmap.ic_launcher) .setContentTitle("Temperature Alert").setContentText(notificationSmall) .setStyle(new NotificationCompat.BigTextStyle().bigText(notificationBig)) .setContentIntent(piContent).setDefaults(Notification.DEFAULT_SOUND) .setLights(Color.BLUE, 500, 1000); _notificationManager.notify(Config.ALERT_NOTIFICATION_ID, _notificationBuilder.build()); }
From source file:com.hacktx.android.activities.MainActivity.java
private void displayWelcome() { if (UserStateStore.isFirstLaunch(this)) { Log.i(TAG, "Starting WelcomeActivity..."); Intent intent = new Intent(this, WelcomeActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);/*from w w w .j a v a 2s. c om*/ finish(); } else { displaySlackAlert(); } }
From source file:id.zelory.codepolitan.ui.MainActivity.java
public void onReload() { Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent);/* ww w. ja v a 2s . c o m*/ finish(); }
From source file:com.frostwire.android.gui.NotificationUpdateDemon.java
private PendingIntent createShowFrostwireIntent() { return PendingIntent.getActivity(mParentContext, 0, new Intent(mParentContext, MainActivity.class).setAction(Constants.ACTION_SHOW_TRANSFERS) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK), 0);//w w w .j a va 2s. co m }
From source file:samples.piggate.com.piggateCompleteExample.Activity_SingIn.java
public void backButton() { Intent slideactivity = new Intent(Activity_SingIn.this, Activity_Main.class); slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); Bundle bndlanimation = ActivityOptions .makeCustomAnimation(getApplicationContext(), R.anim.slidefromleft, R.anim.slidetoright).toBundle(); startActivity(slideactivity, bndlanimation); }