当前位置: 首页>>代码示例>>Java>>正文


Java Intent.ACTION_CREATE_DOCUMENT属性代码示例

本文整理汇总了Java中android.content.Intent.ACTION_CREATE_DOCUMENT属性的典型用法代码示例。如果您正苦于以下问题:Java Intent.ACTION_CREATE_DOCUMENT属性的具体用法?Java Intent.ACTION_CREATE_DOCUMENT怎么用?Java Intent.ACTION_CREATE_DOCUMENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.content.Intent的用法示例。


在下文中一共展示了Intent.ACTION_CREATE_DOCUMENT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performExport

private void performExport(final boolean includeGlobals, final Account account) {
    // TODO, prompt to allow a user to choose which accounts to export
    ArrayList<String> accountUuids = null;
    if (account != null) {
        accountUuids = new ArrayList<>();
        accountUuids.add(account.getUuid());
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        exportGlobalSettings = includeGlobals;
        exportAccountUuids = accountUuids;

        Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
        intent.setType("application/octet-stream");
        intent.putExtra(Intent.EXTRA_TITLE, SettingsExporter.generateDatedExportFileName());
        intent.addCategory(Intent.CATEGORY_OPENABLE);

        startActivityForResult(intent, ACTIVITY_REQUEST_SAVE_SETTINGS_FILE);
    } else {
        startExport(includeGlobals, accountUuids, null);
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:22,代码来源:Accounts.java

示例2: exportDocument

/**
 * This method starts create document system activity.
 * @param activity
 * @param doc
 */
@TargetApi(Build.VERSION_CODES.KITKAT)
public static void exportDocument(Activity activity,
                                  DocumentMetadata doc) {
    Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);

    // show only results that can be "opened", such as a file
    intent.addCategory(Intent.CATEGORY_OPENABLE);

    // create a file with plain text MIME type
    intent.setType(MIME_TYPE);
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
    String currentDate = sdf.format(new Date());
    String suggestedName = String.format(SUGGESTED_NAME_FORMAT, doc.getName(), currentDate);
    intent.putExtra(Intent.EXTRA_TITLE, suggestedName);
    activity.startActivityForResult(intent, WRITE_REQUEST_CODE);
}
 
开发者ID:nfdz,项目名称:foco,代码行数:21,代码来源:ImportExportUtils.java

示例3: onBackupDone

public void onBackupDone(File file) {
    if (file == null) {
        setDone(R.string.error_generic);
        return;
    }
    if (Build.VERSION.SDK_INT >= 19) {
        mBackupFile = file;
        Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        intent.setType(MimeTypeMap.getSingleton().getMimeTypeFromExtension("zip"));
        String date = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(new Date());
        intent.putExtra(Intent.EXTRA_TITLE, "irc-client-backup-" + date + ".zip");
        startActivityForResult(intent, BACKUP_FILE_REQUEST_CODE);
        setSlideAnimation(false);
    } else {
        // TODO:
    }
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:18,代码来源:BackupProgressActivity.java

示例4: saveTheFile

private void saveTheFile(boolean saveAs) {
    if (!saveAs && greatUri != null && greatUri.getUri() != null && greatUri.getUri() != Uri.EMPTY)
        new SaveFileTask(this, greatUri, pageSystem.getAllText(mEditor.getText()
                .toString()), currentEncoding, new SaveFileTask.SaveFileInterface() {
            @Override
            public void fileSaved(Boolean success) {
                savedAFile(greatUri, true);
            }
        }).execute();
    else {
        if (Device.hasKitKatApi() && PreferenceHelper.getUseStorageAccessFramework(this)) {
            Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
            intent.setType("*/*");
            intent.putExtra(Intent.EXTRA_TITLE, greatUri.getFileName());
            startActivityForResult(intent, SAVE_AS_REQUEST_CODE);
        } else {
            new NewFileDetailsDialog(
                    greatUri,
                    pageSystem.getAllText(mEditor.getText().toString()),
                    currentEncoding
            ).show(getFragmentManager().beginTransaction(), "dialog");
        }

    }
}
 
开发者ID:ujjwalagrawal17,项目名称:CodeCompilerApp,代码行数:25,代码来源:MainActivity.java

示例5: openFilePicker

@TargetApi(Build.VERSION_CODES.KITKAT)
public static void openFilePicker(Fragment fragment) {
    Intent i = new Intent(Intent.ACTION_CREATE_DOCUMENT);
    i.addCategory(Intent.CATEGORY_OPENABLE);
    i.setType("audio/*");
    i.putExtra("android.content.extra.SHOW_ADVANCED", true);
    fragment.startActivityForResult(i, SAFUtil.REQUEST_SAF_PICK_FILE);
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:8,代码来源:SAFUtil.java

示例6: CreateFile

public void CreateFile(View view) {
    if (Device.hasKitKatApi() && PreferenceHelper.getUseStorageAccessFramework(this)) {
        Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
        intent.setType("*/*");
        //intent.putExtra(Intent.EXTRA_TITLE, ".txt");
        startActivityForResult(intent, CREATE_REQUEST_CODE);
    } else {
        newFileToOpen(new GreatUri(Uri.EMPTY, "", ""), "");
    }
}
 
开发者ID:ujjwalagrawal17,项目名称:CodeCompilerApp,代码行数:10,代码来源:MainActivity.java


注:本文中的android.content.Intent.ACTION_CREATE_DOCUMENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。