List of usage examples for android.content Intent ACTION_CREATE_DOCUMENT
String ACTION_CREATE_DOCUMENT
To view the source code for android.content Intent ACTION_CREATE_DOCUMENT.
Click Source Link
From source file:ca.rmen.android.poetassistant.main.reader.ReaderFragment.java
@TargetApi(Build.VERSION_CODES.KITKAT) private void saveAs() { Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("text/plain"); PoemFile poemFile = mPoemPrefs.getSavedPoem(); final String fileName; if (poemFile != null) { fileName = poemFile.name;//from w w w . ja v a2s .c o m } else { fileName = PoemFile.generateFileName(mBinding.tvText.getText().toString()); } if (!TextUtils.isEmpty(fileName)) intent.putExtra(Intent.EXTRA_TITLE, fileName); startActivityForResult(intent, ACTION_FILE_SAVE_AS); }
From source file:org.fedorahosted.freeotp.MainActivity.java
private void createFile(String mimeType, String fileName) { Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); // Filter to only show results that can be "opened", such as // a file (as opposed to a list of contacts or timezones). intent.addCategory(Intent.CATEGORY_OPENABLE); // Create a file with the requested MIME type. intent.setType(mimeType);//from w w w . j av a 2 s . c om intent.putExtra(Intent.EXTRA_TITLE, fileName); startActivityForResult(intent, WRITE_REQUEST_CODE); }
From source file:com.android.documentsui.DocumentsActivity.java
private void buildDefaultState() { mState = new State(); final Intent intent = getIntent(); final String action = intent.getAction(); if (Intent.ACTION_OPEN_DOCUMENT.equals(action)) { mState.action = ACTION_OPEN;/*from www. ja v a 2 s .c om*/ } else if (Intent.ACTION_CREATE_DOCUMENT.equals(action)) { mState.action = ACTION_CREATE; } else if (Intent.ACTION_GET_CONTENT.equals(action)) { mState.action = ACTION_GET_CONTENT; } else if (DocumentsContract.ACTION_MANAGE_ROOT.equals(action)) { mState.action = ACTION_MANAGE; } if (mState.action == ACTION_OPEN || mState.action == ACTION_GET_CONTENT) { mState.allowMultiple = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false); } if (mState.action == ACTION_MANAGE) { mState.acceptMimes = new String[] { "*/*" }; mState.allowMultiple = true; } else if (intent.hasExtra(Intent.EXTRA_MIME_TYPES)) { mState.acceptMimes = intent.getStringArrayExtra(Intent.EXTRA_MIME_TYPES); } else { mState.acceptMimes = new String[] { intent.getType() }; } mState.localOnly = intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false); mState.forceAdvanced = intent.getBooleanExtra(DocumentsContract.EXTRA_SHOW_ADVANCED, false); mState.showAdvanced = mState.forceAdvanced | SettingsActivity.getDisplayAdvancedDevices(this); }
From source file:cn.edu.wyu.documentviewer.DocumentsActivity.java
private void buildDefaultState() { mState = new State(); final Intent intent = virtualIntent; final String action = intent.getAction(); if (Intent.ACTION_OPEN_DOCUMENT.equals(action)) { mState.action = ACTION_OPEN;/*www . j a va 2 s. co m*/ } else if (Intent.ACTION_CREATE_DOCUMENT.equals(action)) { mState.action = ACTION_CREATE; } else if (Intent.ACTION_GET_CONTENT.equals(action)) { mState.action = ACTION_GET_CONTENT; } else if (DocumentsContract.ACTION_MANAGE_ROOT.equals(action)) { mState.action = ACTION_MANAGE; } if (mState.action == ACTION_OPEN || mState.action == ACTION_GET_CONTENT) { mState.allowMultiple = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false); } if (mState.action == ACTION_MANAGE) { mState.acceptMimes = new String[] { "*/*" }; mState.allowMultiple = true; } else if (intent.hasExtra(Intent.EXTRA_MIME_TYPES)) { mState.acceptMimes = intent.getStringArrayExtra(Intent.EXTRA_MIME_TYPES); } else { mState.acceptMimes = new String[] { intent.getType() }; } mState.localOnly = intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false); mState.forceAdvanced = intent.getBooleanExtra(DocumentsContract.EXTRA_SHOW_ADVANCED, false); mState.showAdvanced = mState.forceAdvanced | SettingsActivity.getDisplayAdvancedDevices(this); }
From source file:de.schildbach.wallet.ui.backup.BackupWalletDialogFragment.java
private void backupWallet() { passwordView.setEnabled(false);//from w ww .java2s . co m passwordAgainView.setEnabled(false); final DateFormat dateFormat = Iso8601Format.newDateFormat(); dateFormat.setTimeZone(TimeZone.getDefault()); final StringBuilder filename = new StringBuilder(Constants.Files.EXTERNAL_WALLET_BACKUP); filename.append('-'); filename.append(dateFormat.format(new Date())); final Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType(Constants.MIMETYPE_WALLET_BACKUP); intent.putExtra(Intent.EXTRA_TITLE, filename.toString()); startActivityForResult(intent, REQUEST_CODE_CREATE_DOCUMENT); }
From source file:com.orange.ocara.ui.activity.ListAuditActivity.java
private void createNewDocument(String path) { Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType(//from w w w. j a va2 s . c o m MimeTypeMap.getSingleton().getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(path))); startActivityForResult(intent, ACTION_CREATE_NEW_DOCUMENT); }
From source file:com.slim.turboeditor.activity.MainActivity.java
public void saveTheFile(final boolean saveAs) { if (!saveAs && mFile != null && mFile.exists()) { Observable<Boolean> saveFile = getSaveFileObservable(getApplicationContext(), mFile, pageSystem.getAllText(mEditor.getText().toString()), currentEncoding) .subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).cache(); saveFile.subscribe(new Action1<Boolean>() { @Override//from w w w .j av a 2s.c o m public void call(Boolean aBoolean) { Log.d("call(" + aBoolean + ")"); savedAFile(aBoolean); } }); } else { Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); intent.setType("*/*"); intent.putExtra(Intent.EXTRA_TITLE, mFile.getName()); startActivityForResult(intent, SAVE_AS_REQUEST_CODE); } }
From source file:org.mklab.mikity.android.MainActivity.java
/** * ?????????/*from ww w . jav a 2 s .c o m*/ */ public void sendFileChooseIntentForSavingModel() { final Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); intent.setType("*/*"); //$NON-NLS-1$ intent.putExtra(Intent.EXTRA_TITLE, "temp.m3d"); //$NON-NLS-1$ startActivityForResult(intent, REQUEST_CODE_SAVE_MODEL_DATA_FILE); }
From source file:org.kontalk.util.MediaStorage.java
@TargetApi(Build.VERSION_CODES.KITKAT) public static void createFile(Fragment fragment, String mimeType, String fileName, int requestCode) { Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); // Filter to only show results that can be "opened", such as // a file (as opposed to a list of contacts or timezones). intent.addCategory(Intent.CATEGORY_OPENABLE); // Create a file with the requested MIME type. intent.setType(mimeType);/*from w w w. ja v a 2 s. com*/ // Note: This is not documented, but works intent.putExtra("android.content.extra.SHOW_ADVANCED", true); intent.putExtra(Intent.EXTRA_TITLE, fileName); fragment.startActivityForResult(intent, requestCode); }
From source file:com.farmerbb.notepad.activity.MainActivity.java
@TargetApi(Build.VERSION_CODES.KITKAT) private void reallyExportNotes() { String filename = ""; try {/*from w ww . j a va 2s .c o m*/ filename = loadNoteTitle(filesToExport[fileBeingExported].toString()); } catch (IOException e) { /* Gracefully fail */ } Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TITLE, generateFilename(filename)); try { startActivityForResult(intent, EXPORT); } catch (ActivityNotFoundException e) { showToast(R.string.error_exporting_notes); } }