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.devspark.sidenavigation.meiriyiwen.MainActivity.java
private void invokeActivity5(String title, int resId) { Intent intent = new Intent(this, baseMenuActivity5.class); intent.putExtra(EXTRA_TITLE, title); intent.putExtra(EXTRA_RESOURCE_ID, resId); intent.putExtra(EXTRA_MODE, sideNavigationView.getMode() == Mode.LEFT ? 0 : 1); // all of the other activities on top of it will be closed and this // Intent will be delivered to the (now on top) old activity as a // new Intent. intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);/*w ww . j a v a2s . c o m*/ // no animation of transition overridePendingTransition(0, 0); }
From source file:at.jclehner.rxdroid.SplashScreenActivity.java
private void launchMainActivity() { (new Thread() { @SuppressWarnings("unused") @Override/*from w ww. ja v a2s. co m*/ public void run() { while (Database.hasPendingOperations()) { Log.i(TAG, "Waiting for database to settle"); try { Thread.sleep(50); } catch (InterruptedException e) { Log.w(TAG, e); break; } } final boolean isFirstLaunch; if (!BuildConfig.DEBUG && Database.countAll(Drug.class) != 0) { isFirstLaunch = false; Settings.putBoolean(Settings.Keys.IS_FIRST_LAUNCH, false); } else isFirstLaunch = Settings.getBoolean(Settings.Keys.IS_FIRST_LAUNCH, true); final Class<?> intentClass = isFirstLaunch ? DoseTimePreferenceActivity.class : DrugListActivity.class; Intent intent = new Intent(getBaseContext(), intentClass); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_ANIMATION); intent.putExtra(DoseTimePreferenceActivity.EXTRA_IS_FIRST_LAUNCH, isFirstLaunch); intent.putExtra(DrugListActivity.EXTRA_DATE, mDate); startActivity(intent); finish(); } }).start(); }
From source file:com.parse.ParsePushBroadcastReceiver.java
/** * Called when the push notification is opened by the user. Sends analytics info back to Parse * that the application was opened from this push notification. By default, this will navigate * to the {@link Activity} returned by {@link #getActivity(Context, Intent)}. If the push contains * a 'uri' parameter, an Intent is fired to view that URI with the Activity returned by * {@link #getActivity} in the back stack. * * @param context/* w w w . j a v a 2 s. c o m*/ * The {@code Context} in which the receiver is running. * @param intent * An {@code Intent} containing the channel and data of the current push notification. */ protected void onPushOpen(Context context, Intent intent) { // Send a Parse Analytics "push opened" event ParseAnalytics.trackAppOpenedInBackground(intent); String uriString = null; try { JSONObject pushData = new JSONObject(intent.getStringExtra(KEY_PUSH_DATA)); uriString = pushData.optString("uri", null); } catch (JSONException e) { PLog.e(TAG, "Unexpected JSONException when receiving push data: ", e); } Class<? extends Activity> cls = getActivity(context, intent); Intent activityIntent; if (uriString != null) { activityIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uriString)); } else { activityIntent = new Intent(context, cls); } activityIntent.putExtras(intent.getExtras()); /* In order to remove dependency on android-support-library-v4 The reason why we differentiate between versions instead of just using context.startActivity for all devices is because in API 11 the recommended conventions for app navigation using the back key changed. */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { TaskStackBuilderHelper.startActivities(context, cls, activityIntent); } else { activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(activityIntent); } }
From source file:com.netpace.expressit.activity.UploadImageStoryActivity.java
private void publishMediaOnRemoteServer() { dialog.setMessage("Publish data on XIT"); Media media = new Media(); media.setMediaShortURL(fileKey);/*from w w w .java 2 s .c o m*/ media.setMediaName(fileKey + "." + FileUtils.getFileExtension(img_filePath)); media.setMediaCaption(titleTextView.getText().toString()); media.setMediaType(MediaTypeEnum.IMAGE); Meta meta = new Meta(); meta.setWidth(widthAfter); meta.setHeight(heightAfter); media.setMeta(meta); ADMediaSharingUtil.getRestClient(UploadImageStoryActivity.this) .load(AppConstants.DOMAIN_URL + AppConstants.PUBLISH_MEDIA_URL).setJsonObjectBody(media).asString() .withResponse().setCallback(new FutureCallback<Response<String>>() { @Override public void onCompleted(Exception e, Response<String> result) { if (dialog.isShowing()) dialog.dismiss(); if (e == null && result.getHeaders().getResponseCode() == HttpStatus.SC_OK) { Toast.makeText(UploadImageStoryActivity.this, "Uploaded Successfully", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(UploadImageStoryActivity.this, SlideMenuActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } else { Toast.makeText(UploadImageStoryActivity.this, e.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); } } }); }
From source file:com.battlelancer.seriesguide.ui.EpisodesActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int itemId = item.getItemId(); if (itemId == android.R.id.home) { Intent upIntent;//from www. j av a 2s . c om upIntent = new Intent(this, OverviewActivity.class); upIntent.putExtra(OverviewFragment.InitBundle.SHOW_TVDBID, mShowId); upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(upIntent); return true; } return super.onOptionsItemSelected(item); }
From source file:ca.etsmtl.applets.etsmobile.ScheduleActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent = null;/*from w w w . j a v a 2 s . c o m*/ switch (item.getItemId()) { case R.id.calendar_week_view: intent = new Intent(this, ScheduleWeekActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); break; case R.id.calendar_force_update: new CalendarTask(handler).execute(creds); break; default: break; } if (intent != null) { startActivity(intent); finish(); } return true; }
From source file:at.jclehner.rxdroid.NotificationReceiver.java
private PendingIntent createDrugListIntent(Date date) { final Intent intent = new Intent(mContext, DrugListActivity.class); intent.putExtra(DrugListActivity.EXTRA_STARTED_FROM_NOTIFICATION, true); intent.putExtra(DrugListActivity.EXTRA_DATE, date); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); return PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); }
From source file:com.alivenet.dmvtaxi.Activity_ConfirmMybooking.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.custome_map); Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar); setSupportActionBar(toolbar);//ww w . ja v a 2 s.c o m getSupportActionBar().setDisplayHomeAsUpEnabled(true); mPref = Activity_ConfirmMybooking.this.getSharedPreferences(MYPREF, Context.MODE_PRIVATE); mtvpickup_address = (TextView) findViewById(R.id.tv_pickup_address); mtvdrop_address = (TextView) findViewById(R.id.tv_drop_address); mtvestimateprice = (TextView) findViewById(R.id.tv_primerate); mconfirmbooking = (LinearLayout) findViewById(R.id.ll_confirmbooking); cinfirmbooking = (TextView) findViewById(R.id.cinfirmbooking); mivimagecar = (ImageView) findViewById(R.id.iv_carimage); Bundle b = getIntent().getExtras(); Bundle b1 = getIntent().getExtras(); latitude = b1.getDouble("currentlatitude"); longitude = b1.getDouble("currentlongitude"); lat = b.getDouble("distantionLat"); lng = b.getDouble("distantionLng"); prgDialog = new ProgressDialog(this); prgDialog.setMessage("Please wait..."); prgDialog.setCancelable(false); pickup_address = getIntent().getStringExtra("pickup_address"); drop_address = getIntent().getStringExtra("drop_address"); cabId = getIntent().getStringExtra("cabId"); paymentoption = getIntent().getStringExtra("paymentoption"); passenger = getIntent().getStringExtra("passenger"); userId = getIntent().getStringExtra("userId"); cinfirmbooking.setText("CONFIRM BOOKING"); mivimagecar.startAnimation(inFromRightAnimation()); if (pickup_address != null) { mtvpickup_address.setText(pickup_address); mtvdrop_address.setText(drop_address); } if (getIntent() != null) { baseFare = Double.parseDouble(getIntent().getStringExtra("baseFare")); baseFareDistance = Double.parseDouble(getIntent().getStringExtra("baseFareDistance")); perKm = Double.parseDouble(getIntent().getStringExtra("perKm")); waitingCharge = Double.parseDouble(getIntent().getStringExtra("waitingCharge")); am_additioncharge = Double.parseDouble(getIntent().getStringExtra("madditioncharge")); am_telephone_dispatch = Double.parseDouble(getIntent().getStringExtra("mtelephone_dispatch")); am_passengerSurgcharge = Double.parseDouble(getIntent().getStringExtra("mpassengerSurgcharge")); am_luggagecharge = Double.parseDouble(getIntent().getStringExtra("mluggagecharge")); am_airportSurcharge = Double.parseDouble(getIntent().getStringExtra("mairportSurcharge")); am_additionHourcharge = Double.parseDouble(getIntent().getStringExtra("madditionHourcharge")); am_perpassengercharge = Double.parseDouble(getIntent().getStringExtra("mperpassengercharge")); am_snowcharge = Double.parseDouble(getIntent().getStringExtra("msnowcharge")); System.out.println("am_additioncharge==>>" + am_additioncharge); System.out.println("am_telephone_dispatch==>>" + am_telephone_dispatch); System.out.println("am_passengerSurgcharge==>>" + am_passengerSurgcharge); System.out.println("am_luggagecharge==>>" + am_luggagecharge); System.out.println("am_airportSurcharge==>>" + am_airportSurcharge); System.out.println("am_additionHourcharge==>>" + am_additionHourcharge); System.out.println("am_perpassengercharge==>>" + am_perpassengercharge); System.out.println("am_snowcharge==>>" + am_snowcharge); } googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.mapdirection)).getMap(); googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); googleMap.setMyLocationEnabled(true); if (latitude != 0.0d && longitude != 0.0d) { Log.e("longitudeconfirm", "" + longitude); Log.e("latitudeconfirm", "" + latitude); drawMarker(new LatLng(longitude, longitude)); MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title(""); marker.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)); CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng(latitude, longitude)) .zoom(10).build(); googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); googleMap.addMarker(marker); if (ActivityCompat.checkSelfPermission(Activity_ConfirmMybooking.this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(Activity_ConfirmMybooking.this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { } googleMap.setMyLocationEnabled(true); } if (lat != 0.0d && lng != 0.0d) { drawMarkerOnActivity(new LatLng(lat, lng)); googleMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(lat, lng))); // Setting the zoom level in the map on last position is clicked googleMap.animateCamera(CameraUpdateFactory.zoomTo(Float.parseFloat(zoom))); } mconfirmbooking.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (userId != null && latitude != 0.0d && longitude != 0.0d && lat != 0.0d && lng != 0.0d && cabId != null && paymentoption != null) { ride_trip_validate = new Ride_trip_validate(); // ride_trip_validate.Ride_trip_validategetvalue(userId, String.valueOf(latitude), String.valueOf(longitude), String.valueOf(lat), String.valueOf(lng), cabId,paymentoption); ride_trip_validate.execute(); //validateRide(userId, String.valueOf(latitude), String.valueOf(longitude), String.valueOf(lat), String.valueOf(lng), cabId,paymentoption); } } }); cinfirmbooking.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (cinfirmbooking.getText().equals("Share Of The Fare")) { Intent in = new Intent(Activity_ConfirmMybooking.this, SplitAddFrnd.class); in.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(in); } else { if (userId != null && latitude != 0.0d && longitude != 0.0d && lat != 0.0d && lng != 0.0d && cabId != null && paymentoption != null) ride_trip_validate = new Ride_trip_validate(); ride_trip_validate.execute(); } } }); validateGET_TIME(latitude, longitude, lat, lng); }
From source file:app.sunstreak.yourpisd.ClassSwipeActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent;/*from w w w .j av a 2 s . co m*/ // Handle item selection switch (item.getItemId()) { case R.id.log_out: SharedPreferences.Editor editor = getPreferences(Context.MODE_PRIVATE).edit(); editor.putBoolean("auto_login", false); editor.commit(); intent = new Intent(this, LoginActivity.class); // Clear all activities between this and LoginActivity intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); return true; /* case R.id.refresh: Intent refreshIntent = new Intent(this, LoginActivity.class); refreshIntent.putExtra("Refresh", true); startActivity(refreshIntent); finish(); return true; */ case R.id.previous_six_weeks: intent = new Intent(this, ClassSwipeActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("studentIndex", studentIndex); intent.putExtra("classCount", classCount); intent.putExtra("classIndex", mViewPager.getCurrentItem()); // Don't go into the negatives! intent.putExtra("termIndex", Math.max(termIndex - 1, 0)); startActivity(intent); // overridePendingTransition(R.anim.slide_in_down, R.anim.slide_out_up); return true; case R.id.next_six_weeks: intent = new Intent(this, ClassSwipeActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("studentIndex", studentIndex); intent.putExtra("classCount", classCount); intent.putExtra("classIndex", mViewPager.getCurrentItem()); // Don't go too positive! intent.putExtra("termIndex", Math.min(termIndex + 1, 7)); startActivity(intent); // overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_down); return true; default: return super.onOptionsItemSelected(item); } }
From source file:de.elanev.studip.android.app.backend.net.oauth.SignInFragment.java
/** * Starts the next activity after prefetching. *//*from www.j a v a2 s . c om*/ public void startMainActivity() { Intent intent = new Intent(getActivity(), MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); Log.i(TAG, "Starting news Activity..."); if (!ApiUtils.isOverApi11()) { getActivity().finish(); } }