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:br.gbizotto.customcamera.camera2.Camera2BasicFragment.java
@Override public void pictureSaved(String filePath) { Intent intent = new Intent(getActivity(), ReviewPictureActivity.class); intent.putExtra("filePath", filePath); intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS).addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent);/* w w w. j a v a 2s . c om*/ }
From source file:com.raffaele.squarecash4glass.CVVConfirmActivity.java
private void doLaunchTransactionCompleted() { // startActivity(new Intent(this, // ContactActivity.class).addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY|Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK)); startActivity(new Intent(this, TransactionCompleted.class).addFlags( Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)); }
From source file:com.giovanniterlingen.windesheim.view.DownloadsActivity.java
private void updateFilesList() { final File path = Environment.getExternalStoragePublicDirectory( ApplicationLoader.applicationContext.getResources().getString(R.string.app_name)); File files[] = path.listFiles(); if (files != null && files.length > 0) { List<NatschoolContent> contents = new ArrayList<>(); for (File f : files) { if (!f.isDirectory()) { contents.add(new NatschoolContent(f.getName())); }//from ww w .j a v a 2 s. co m } if (contents.size() == 0) { showEmptyTextview(); } else { hideEmptyTextview(); } if (recyclerView == null) { recyclerView = findViewById(R.id.downloads_recyclerview); recyclerView.setLayoutManager(new LinearLayoutManager(this)); } recyclerView.setAdapter(new NatschoolContentAdapter(this, contents) { @Override protected void onContentClick(NatschoolContent content, int position) { Uri uri; File file = new File(path.getAbsolutePath() + File.separator + content.name); Intent target = new Intent(Intent.ACTION_VIEW); if (android.os.Build.VERSION.SDK_INT >= 24) { uri = FileProvider.getUriForFile(DownloadsActivity.this, "com.giovanniterlingen.windesheim.provider", file); target.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_GRANT_READ_URI_PERMISSION); } else { uri = Uri.fromFile(file); 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 { startActivity(target); } catch (ActivityNotFoundException e) { if (view != null) { Snackbar snackbar = Snackbar.make(view, getResources().getString(R.string.no_app_found), Snackbar.LENGTH_SHORT); snackbar.show(); } } } }); } else { showEmptyTextview(); } }
From source file:com.jbirdvegas.mgerrit.GerritControllerActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent;//from ww w .j ava 2 s . c om switch (item.getItemId()) { case R.id.menu_save: intent = new Intent(this, PrefsActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent); return true; case R.id.menu_help: showHelpDialog(); return true; case R.id.menu_refresh: refreshTabs(); return true; case R.id.menu_team_instance: intent = new Intent(this, GerritSwitcher.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent); return true; case R.id.menu_projects: intent = new Intent(this, ProjectsList.class); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent); return true; case R.id.menu_changelog: // TODO: Send the current search query along too. Intent changelog = new Intent(this, AOKPChangelog.class); changelog.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(changelog); return true; case R.id.menu_search: // Toggle the visibility of the searchview mSearchView.toggleVisibility(); default: return super.onOptionsItemSelected(item); } }
From source file:com.github.notizklotz.derbunddownloader.issuesgrid.DownloadedIssuesActivity.java
private void openPDF(String uri) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(uri)), MEDIA_TYPE_PDF); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); PackageManager packageManager = getPackageManager(); assert packageManager != null; if (intent.resolveActivity(packageManager) != null) { startActivity(intent);// w w w. ja va2 s . c o m } else { Toast.makeText(this, R.string.no_pdf_reader, Toast.LENGTH_LONG).show(); } }
From source file:ufms.br.com.ufmsapp.fragment.MateriaisDisciplinaFragment.java
private void openDocument(String path) { String fileName = path.replace(DownloadTask.UPLOAD_PATH_REPLACE, ""); Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), fileName);/*from w ww . j av a 2s . c o m*/ intent.setDataAndType(Uri.fromFile(file), GetFileMimeType.getMimeType(fileName)); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent); }
From source file:fm.smart.r1.activity.CreateSoundActivity.java
public void onClick(View v) { String threegpfile_name = "test.3gp_amr"; String amrfile_name = "test.amr"; File dir = this.getDir("sounds", MODE_WORLD_READABLE); final File threegpfile = new File(dir, threegpfile_name); File amrfile = new File(dir, amrfile_name); String path = threegpfile.getAbsolutePath(); Log.d("CreateSoundActivity", path); Log.d("CreateSoundActivity", (String) button.getText()); if (button.getText().equals("Start")) { try {//from w w w. ja v a 2 s . c o m recorder = new MediaRecorder(); // ContentValues values = new ContentValues(3); // // values.put(MediaStore.MediaColumns.TITLE, "test"); // values.put(MediaStore.MediaColumns.DATE_ADDED, // System.currentTimeMillis()); // values.put(MediaStore.MediaColumns.MIME_TYPE, // MediaRecorder.OutputFormat.THREE_GPP); // // ContentResolver contentResolver = new ContentResolver(this); // // Uri base = MediaStore.Audio.INTERNAL_CONTENT_URI; // Uri newUri = contentResolver.insert(base, values); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setOutputFile(path); recorder.prepare(); button.setText("Stop"); recorder.start(); } catch (Exception e) { Log.w(TAG, e); } } else { FileOutputStream os = null; FileInputStream is = null; try { recorder.stop(); recorder.release(); // Now the object cannot be reused button.setEnabled(false); // ThreegpReader tr = new ThreegpReader(threegpfile); // os = new FileOutputStream(amrfile); // tr.extractAmr(os); is = new FileInputStream(threegpfile); playSound(is.getFD()); final String media_entity = "http://test.com/test.mp3"; final String author = "tansaku"; final String author_url = "http://smart.fm/users/tansaku"; if (Main.isNotLoggedIn(this)) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName(this, LoginActivity.class.getName()); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); LoginActivity.return_to = CreateSoundActivity.class.getName(); LoginActivity.params = new HashMap<String, String>(); LoginActivity.params.put("item_id", item_id); LoginActivity.params.put("list_id", list_id); LoginActivity.params.put("id", id); LoginActivity.params.put("to_record", to_record); LoginActivity.params.put("sound_type", sound_type); startActivity(intent); } else { final ProgressDialog myOtherProgressDialog = new ProgressDialog(this); myOtherProgressDialog.setTitle("Please Wait ..."); myOtherProgressDialog.setMessage("Creating Sound ..."); myOtherProgressDialog.setIndeterminate(true); myOtherProgressDialog.setCancelable(true); final Thread create_sound = new Thread() { public void run() { // TODO make this interruptable .../*if // (!this.isInterrupted())*/ CreateSoundActivity.create_sound_result = createSound(threegpfile, media_entity, author, author_url, "1", id); myOtherProgressDialog.dismiss(); } }; myOtherProgressDialog.setButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { create_sound.interrupt(); } }); OnCancelListener ocl = new OnCancelListener() { public void onCancel(DialogInterface arg0) { create_sound.interrupt(); } }; myOtherProgressDialog.setOnCancelListener(ocl); myOtherProgressDialog.show(); create_sound.start(); } } catch (Exception e) { Log.w(TAG, e); } finally { if (os != null) { try { os.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (is != null) { try { is.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } }
From source file:com.abhijitvalluri.android.fitnotifications.HomeFragment.java
private void initializeButtons() { initializeServiceButtons();// w w w. j a v a2 s.c o m initializeDemoButton(); initializeEnableNotificationButton(); mImproveTransliterationTV.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String uriText = "mailto:android@abhijitvalluri.com" + "?subject=" + Uri.encode("Improve Transliterations for <SPECIFY_LANGUAGE>") + "&body=" + Uri.encode("<MESSAGE>"); Uri uri = Uri.parse(uriText); Intent sendIntent = new Intent(Intent.ACTION_SENDTO); sendIntent.setData(uri); startActivity(Intent.createChooser(sendIntent, "Send email")); } }); mRateAppTV.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Uri uri = Uri.parse("market://details?id=" + Constants.PACKAGE_NAME); Intent gotoPlayStore = 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. gotoPlayStore.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); try { startActivity(gotoPlayStore); } catch (ActivityNotFoundException e) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + Constants.PACKAGE_NAME))); } } }); }
From source file:fm.smart.r1.CreateSoundActivity.java
public void onClick(View v) { String threegpfile_name = "test.3gp_amr"; String amrfile_name = "test.amr"; File dir = this.getDir("sounds", MODE_WORLD_READABLE); final File threegpfile = new File(dir, threegpfile_name); File amrfile = new File(dir, amrfile_name); String path = threegpfile.getAbsolutePath(); Log.d("CreateSoundActivity", path); Log.d("CreateSoundActivity", (String) button.getText()); if (button.getText().equals("Start")) { try {//from ww w . j a v a2 s . c om recorder = new MediaRecorder(); // ContentValues values = new ContentValues(3); // // values.put(MediaStore.MediaColumns.TITLE, "test"); // values.put(MediaStore.MediaColumns.DATE_ADDED, // System.currentTimeMillis()); // values.put(MediaStore.MediaColumns.MIME_TYPE, // MediaRecorder.OutputFormat.THREE_GPP); // // ContentResolver contentResolver = new ContentResolver(this); // // Uri base = MediaStore.Audio.INTERNAL_CONTENT_URI; // Uri newUri = contentResolver.insert(base, values); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setOutputFile(path); recorder.prepare(); button.setText("Stop"); recorder.start(); } catch (Exception e) { Log.w(TAG, e); } } else { FileOutputStream os = null; FileInputStream is = null; try { recorder.stop(); recorder.release(); // Now the object cannot be reused button.setEnabled(false); // ThreegpReader tr = new ThreegpReader(threegpfile); // os = new FileOutputStream(amrfile); // tr.extractAmr(os); is = new FileInputStream(threegpfile); playSound(is.getFD()); final String media_entity = "http://test.com/test.mp3"; final String author = "tansaku"; final String author_url = "http://smart.fm/users/tansaku"; if (LoginActivity.isNotLoggedIn(this)) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName(this, LoginActivity.class.getName()); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); LoginActivity.return_to = CreateSoundActivity.class.getName(); LoginActivity.params = new HashMap<String, String>(); LoginActivity.params.put("item_id", item_id); LoginActivity.params.put("goal_id", goal_id); LoginActivity.params.put("id", id); LoginActivity.params.put("to_record", to_record); LoginActivity.params.put("sound_type", sound_type); startActivity(intent); } else { final ProgressDialog myOtherProgressDialog = new ProgressDialog(this); myOtherProgressDialog.setTitle("Please Wait ..."); myOtherProgressDialog.setMessage("Creating Sound ..."); myOtherProgressDialog.setIndeterminate(true); myOtherProgressDialog.setCancelable(true); final Thread create_sound = new Thread() { public void run() { // TODO make this interruptable .../*if // (!this.isInterrupted())*/ CreateSoundActivity.create_sound_result = createSound(threegpfile, media_entity, author, author_url, "1", item_id, id, to_record); // this will also ensure item is in goal, but this // should be sentence // submission if we are handling sentence sound. if (sound_type.equals(Integer.toString(R.id.cue_sound))) { CreateSoundActivity.add_item_result = new AddItemResult( Main.lookup.addItemToGoal(Main.transport, Main.default_study_goal_id, item_id, CreateSoundActivity.create_sound_result.sound_id)); } else { // ensure item is in goal CreateSoundActivity.add_item_result = new AddItemResult(Main.lookup .addItemToGoal(Main.transport, Main.default_study_goal_id, item_id, null)); CreateSoundActivity.add_sentence_result = new AddSentenceResult( Main.lookup.addSentenceToGoal(Main.transport, Main.default_study_goal_id, item_id, id, CreateSoundActivity.create_sound_result.sound_id)); } myOtherProgressDialog.dismiss(); } }; myOtherProgressDialog.setButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { create_sound.interrupt(); } }); OnCancelListener ocl = new OnCancelListener() { public void onCancel(DialogInterface arg0) { create_sound.interrupt(); } }; myOtherProgressDialog.setOnCancelListener(ocl); myOtherProgressDialog.show(); create_sound.start(); } } catch (Exception e) { Log.w(TAG, e); } finally { if (os != null) { try { os.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (is != null) { try { is.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } }
From source file:com.crearo.gpslogger.ui.fragments.display.GpsSimpleViewFragment.java
private void startInstalledAppDetailsActivity(final Activity context) { if (context == null) { return;// w w w. j av a2s .c om } 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); }