List of usage examples for android.content Intent FLAG_ACTIVITY_NO_HISTORY
int FLAG_ACTIVITY_NO_HISTORY
To view the source code for android.content Intent FLAG_ACTIVITY_NO_HISTORY.
Click Source Link
From source file:fm.smart.r1.activity.CreateItemActivity.java
public void onClick(View v) { EditText cueInput = (EditText) findViewById(R.id.cue); EditText responseInput = (EditText) findViewById(R.id.response); Spinner posInput = (Spinner) findViewById(R.id.pos); EditText characterResponseInput = (EditText) findViewById(R.id.response_character); EditText characterCueInput = (EditText) findViewById(R.id.cue_character); final String cue = cueInput.getText().toString(); final String response = responseInput.getText().toString(); final String pos = posInput.getSelectedItem().toString(); final String character_cue = characterCueInput.getText().toString(); final String character_response = characterResponseInput.getText().toString(); String pos_code = Utils.POS_MAP.get(pos); if (TextUtils.isEmpty(pos_code)) { pos_code = "NONE"; }// w w w.j a v a2 s. c o m final String final_pos_code = pos_code; if (Main.isNotLoggedIn(this)) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName(this, LoginActivity.class.getName()); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); // avoid // navigation // back to this? LoginActivity.return_to = CreateItemActivity.class.getName(); LoginActivity.params = new HashMap<String, String>(); LoginActivity.params.put("list_id", list_id); LoginActivity.params.put("cue", cue); LoginActivity.params.put("response", response); LoginActivity.params.put("cue_language", cue_language); LoginActivity.params.put("response_language", response_language); LoginActivity.params.put("pos", pos); LoginActivity.params.put("character_cue", character_cue); LoginActivity.params.put("character_response", character_response); startActivity(intent); } else { // TODO cue and response languages need to be inferred from list we are // adding to ... Might want to fix those, i.e. not allow variation // on // search ... // TODO wondering whether there is some way to edit existing items // ... final ProgressDialog myOtherProgressDialog = new ProgressDialog(this); myOtherProgressDialog.setTitle("Please Wait ..."); myOtherProgressDialog.setMessage("Creating Item ..."); myOtherProgressDialog.setIndeterminate(true); myOtherProgressDialog.setCancelable(true); final Thread create_item = new Thread() { public void run() { // TODO make this interruptable .../*if // (!this.isInterrupted())*/ CreateItemActivity.create_item_result = createItem(cue, cue_language, character_cue, final_pos_code, response, response_language, character_response, list_id); myOtherProgressDialog.dismiss(); } }; myOtherProgressDialog.setButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { create_item.interrupt(); } }); OnCancelListener ocl = new OnCancelListener() { public void onCancel(DialogInterface arg0) { create_item.interrupt(); } }; myOtherProgressDialog.setOnCancelListener(ocl); myOtherProgressDialog.show(); create_item.start(); } }
From source file:com.trail.octo.Identity.java
public void requestCameraPermission() { if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { // Should we show an explanation? if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) { Log.e("Check", "Go To Settings"); Toast.makeText(getApplicationContext(), "OCTO requires this Permission to upload Images!", Toast.LENGTH_LONG).show(); final Intent i = new Intent(); i.setAction(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); i.addCategory(Intent.CATEGORY_DEFAULT); i.setData(Uri.parse("package:" + Identity.this.getPackageName())); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); startActivity(i);// Show an expanation to the user *asynchronously* -- don't block // this thread waiting for the user's response! After the user // sees the explanation, try again to request the permission. } else {/*from w w w . ja v a2 s .co m*/ // No explanation needed, we can request the permission. Log.e("Check", "Requesting"); ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA }, REQUEST_CAMERA_PERMISSION); // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an // app-defined int constant. The callback method gets the // result of the request. } } else { Log.e("Check", "Already Granted"); //Already Permission Granted Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, 1); } }
From source file:com.giovanniterlingen.windesheim.controllers.DownloadController.java
@Override protected void onPostExecute(final String result) { activeDownloads.remove(contentId);/*from w ww . j a v a2s . c o m*/ NotificationCenter.getInstance().removeObserver(this, NotificationCenter.downloadCancelled); NotificationCenter.getInstance().postNotificationName(NotificationCenter.downloadFinished, studyRouteId, adapterPosition, contentId); if ("permission".equals(result)) { ((NatschoolActivity) activity).noPermission(); return; } if ("cancelled".equals(result)) { ((NatschoolActivity) activity).downloadCanceled(); return; } if (result != null) { Uri uri; Intent target = new Intent(Intent.ACTION_VIEW); if (android.os.Build.VERSION.SDK_INT >= 24) { uri = FileProvider.getUriForFile(activity, "com.giovanniterlingen.windesheim.provider", new File(result)); target.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_GRANT_READ_URI_PERMISSION); } else { uri = Uri.fromFile(new File(result)); target.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); } String extension = android.webkit.MimeTypeMap.getFileExtensionFromUrl(uri.toString()); String mimetype = android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); target.setDataAndType(uri, mimetype); try { activity.startActivity(target); } catch (ActivityNotFoundException e) { ((NatschoolActivity) activity).noSupportedApp(); } } }
From source file:com.kaproduction.malibilgiler.MainActivity.java
@SuppressWarnings("StatementWithEmptyBody") @Override/* w ww. ja va2s. c om*/ public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_detay) { // Handle the camera action Intent i = new Intent(this, TabbedActivity.class); i.putExtra("TAB_ID", 3); startActivity(i); } else if (id == R.id.nav_vergi) { Intent i1 = new Intent(this, TabbedActivity.class); i1.putExtra("TAB_ID", 0); startActivity(i1); } else if (id == R.id.nav_sosyal) { Intent i2 = new Intent(this, TabbedActivity.class); i2.putExtra("TAB_ID", 1); startActivity(i2); } else if (id == R.id.nav_makro) { Intent i3 = new Intent(this, TabbedActivity.class); i3.putExtra("TAB_ID", 2); startActivity(i3); } else if (id == R.id.nav_gelir) { Intent i4 = new Intent(this, CalculateActivity.class); i4.putExtra("TAB_ID", 0); startActivity(i4); } else if (id == R.id.nav_karPayi) { Intent i5 = new Intent(this, CalculateActivity.class); i5.putExtra("TAB_ID", 1); startActivity(i5); } else if (id == R.id.nav_agi) { Intent i6 = new Intent(this, CalculateActivity.class); i6.putExtra("TAB_ID", 2); startActivity(i6); } else if (id == R.id.nav_asgariUcret) { Intent i6 = new Intent(this, CalculateActivity.class); i6.putExtra("TAB_ID", 3); startActivity(i6); } else if (id == R.id.nav_kapiciUcret) { Intent i7 = new Intent(this, CalculateActivity.class); i7.putExtra("TAB_ID", 4); startActivity(i7); } else if (id == R.id.nav_gecikmeFaizi) { Intent i8 = new Intent(this, CalculateActivity.class); i8.putExtra("TAB_ID", 5); startActivity(i8); } else if (id == R.id.nav_paylas) { sendIntent(); } else if (id == R.id.nav_rating) { Uri uri = Uri.parse("market://details?id=" + MainActivity.this.getPackageName()); Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri); // To count with Play market backstack, After pressing back button, // to taken back to our application, we need to add following flags to intent. goToMarket.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_NEW_DOCUMENT | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); try { startActivity(goToMarket); } catch (ActivityNotFoundException e) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse( "http://play.google.com/store/apps/details?id=" + MainActivity.this.getPackageName()))); } } else if (id == R.id.nav_hakkinda) { showHakkindaDialog(); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; }
From source file:es.usc.citius.servando.calendula.fragments.MedicinesListFragment.java
private void openProspect(Prescription p) { File f = new File(getActivity().getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + "/prospects/" + p.pid + ".pdf"); File file = new File(f.getAbsolutePath()); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/pdf"); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent);/*from ww w . ja v a 2 s . co m*/ }
From source file:org.solovyev.android.calculator.App.java
public static void addIntentFlags(@Nonnull Intent intent, boolean detached, @Nonnull Context context) { int flags = 0; if (!(context instanceof Activity)) { flags = flags | Intent.FLAG_ACTIVITY_NEW_TASK; }//from w ww .j a v a 2 s.com if (detached) { flags = flags | Intent.FLAG_ACTIVITY_NO_HISTORY; } intent.setFlags(flags); }
From source file:com.sean.nanastudio.taoyuanstreetparking.MainActivity.java
public static void startInstalledAppDetailsActivity(final Activity context) { if (context == null) { return;//from w w w.j a v a 2 s . c o m } final Intent i = new Intent(); i.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); i.addCategory(Intent.CATEGORY_DEFAULT); i.setData(Uri.parse("package:" + context.getPackageName())); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); context.startActivity(i); }
From source file:com.hacktx.android.activities.MainActivity.java
private void setupAppShortcuts() { // Setup app shortcuts if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 && mConfigManager.getValue(ConfigParam.CHECK_IN)) { ShortcutManager shortcutManager = getSystemService(ShortcutManager.class); Intent checkInIntent = new Intent(Intent.ACTION_VIEW); checkInIntent.setPackage("com.hacktx.android"); checkInIntent.setClass(this, CheckInActivity.class); checkInIntent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_NEW_DOCUMENT); checkInIntent.putExtra("fromShortcut", true); ShortcutInfo shortcut = new ShortcutInfo.Builder(this, "check-in") .setShortLabel(getString(R.string.app_shortcut_check_in)) .setLongLabel(getString(R.string.app_shortcut_check_in)) .setIcon(Icon.createWithResource(this, R.mipmap.ic_launcher)).setIntent(checkInIntent).build(); shortcutManager.addDynamicShortcuts(Arrays.asList(shortcut)); }//from w ww . jav a 2 s. co m }
From source file:fm.smart.r1.ItemActivity.java
@Override public boolean onOptionsItemSelected(MenuItem menu_item) { switch (menu_item.getItemId()) { case CREATE_EXAMPLE_ID: { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName(this, CreateExampleActivity.class.getName()); AndroidUtils.putExtra(intent, "item_id", (String) item.getId()); AndroidUtils.putExtra(intent, "cue", item.cue_text); AndroidUtils.putExtra(intent, "example_language", Utils.INV_LANGUAGE_MAP.get(item.getCueLanguage())); AndroidUtils.putExtra(intent, "translation_language", Utils.INV_LANGUAGE_MAP.get(item.getResponseLanguage())); startActivity(intent);/* www.j a v a 2 s . com*/ break; } case ADD_TO_GOAL_ID: { // TODO inserting login request here more complicated in as much as // this is not an activity we can simply return to with parameters // although we could jump to this from switch in onCreate // of course there's probably a swish URI way to call, but may take // time to get it just right ... // or should just bring them back and open menu bar ... if (LoginActivity.isNotLoggedIn(this)) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName(this, LoginActivity.class.getName()); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); // avoid // navigation // back to // this? LoginActivity.return_to = ItemActivity.class.getName(); LoginActivity.params = new HashMap<String, String>(); try { LoginActivity.params.put("item_id", (String) item.item_node.getString("id")); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } startActivity(intent); } else { try { addToList((String) item.item_node.getString("id")); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } break; } } return super.onOptionsItemSelected(menu_item); }
From source file:com.mobileman.moments.android.frontend.activity.IncomingCallActivity.java
private void sendNotificationAndFinish() { if (streamingUser != null) { Intent intent = new Intent(getApplicationContext(), MediaPlayerActivity.class); Bundle extras = new Bundle(); extras.putString(MediaPlayerActivity.MEDIA_URL, streamingUser.getStream().getFullVideoUrl()); extras.putString(MediaPlayerActivity.THUMBNAIL_URL, streamingUser.getStream().getFullThumbnailUrl()); extras.putString(MediaPlayerActivity.USER_ID, streamingUser.getUuid()); intent.putExtras(extras);/*from w ww .j a v a2 s.co m*/ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder b = new NotificationCompat.Builder(getApplicationContext()); String notificationTitle = userName + " " + getResources().getString(R.string.isLiveSuffix); String notificationText = "";// getResources().getString(R.string.missedCallNotification) + " " + streamingUser.getName(); String mediaUrl = streamingUser.getStream().getFullVideoUrl(); if ((streamingUser.getStream() != null) && (streamingUser.getStream().getTitle() != null)) { notificationText = streamingUser.getStream().getTitle(); //notificationText + "(" + streamingUser.getStream().getTitle() + ")"; } ImageView incomingCallUserImageView = (ImageView) findViewById(R.id.incomingCallUserImageView); Bitmap bitmap = ((BitmapDrawable) incomingCallUserImageView.getDrawable()).getBitmap(); NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle(); b.setAutoCancel(true).setSmallIcon(R.drawable.ic_launcher).setDefaults(Notification.DEFAULT_ALL) .setWhen(System.currentTimeMillis()).setTicker("X").setContentTitle(notificationTitle) .setContentText(notificationText) .setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND) .setContentIntent(contentIntent); // if (bitmap != null) { // b.setLargeIcon(bitmap); // } NotificationManager notificationManager = (NotificationManager) getApplicationContext() .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(++NOTIFICATION_COUNTER, b.build()); } finish(); }