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


Java Intent.ACTION_OPEN_DOCUMENT属性代码示例

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


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

示例1: importExistingKeyKitKat

/**
 * Fires an intent to spin up the "file chooser" UI and select a private key.
 */
@TargetApi(19)
public boolean importExistingKeyKitKat() {
	// ACTION_OPEN_DOCUMENT is the intent to choose a file via the system's file
	// browser.
	Intent intent = new Intent(Intent.ACTION_OPEN_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);

	// PKCS#8 MIME types aren't widely supported, so we'll try */* fro now.
	intent.setType("*/*");

	try {
		startActivityForResult(intent, REQUEST_CODE_PICK_FILE);
		return true;
	} catch (ActivityNotFoundException e) {
		return false;
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:PubkeyListActivity.java

示例2: chooseFile

@NeedsPermission({Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE})
public void chooseFile(Intent dataIntent) {
    /* Check for network connectivity */
    if (isConnectedToActiveNetwork(this)) {
        // if upload was chosen from the app
        if (dataIntent == null) {
            // Use system file browser
            Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
            intent.setType("*/*");
            intent.addCategory(Intent.CATEGORY_OPENABLE);
            startActivityForResult(Intent.createChooser(intent, "Choose the file to Upload.."), INTENT_FILE_REQUEST);

        } else {
            // If Intent received from implicit intent
            onActivityResult(INTENT_FILE_REQUEST, RESULT_OK, dataIntent);
        }
    } else {
        /* Show no network dialog */
        NoNetworkDialogFragment noNetworkDialogFragment = new NoNetworkDialogFragment();
        noNetworkDialogFragment.show(getSupportFragmentManager(), getString(R.string.no_net_dialog_fragment_tag));
    }
}
 
开发者ID:rumaan,项目名称:file.io-app,代码行数:22,代码来源:MainActivity.java

示例3: setFragment

/**
 * Override the base class because we need a special treatment for the Movies category,
 * that is using the ActionBar list navigation to switch between various fragments
 */
@Override
public void setFragment(String path){
    if(mSelectedItemId == ITEM_ID_PROVIDER){
        Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        intent.setType("video/*");
        startActivityForResult(intent, FILE_CHOOSER_ACTIVITY_REQUEST_CODE);
        //restore browser
        mSelectedItemId = mOldSelectedItemId;
        return ;
    }
    else if (mSelectedItemId == ITEM_ID_MOVIES) {
        setupMovieActionBarNavigation(true);
        // refresh the category list

    }
    else {
        //default case is no navigation in action bar
        ((MainActivity)getActivity()).hideSeachView();
        setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        // and it is handled by the parent class
        super.setFragment(path);
    }

}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:29,代码来源:BrowserCategoryVideo.java

示例4: OpenFile

public void OpenFile(View view) {

        if (Device.hasKitKatApi()  && PreferenceHelper.getUseStorageAccessFramework(this)) {
            // ACTION_OPEN_DOCUMENT is the intent to choose a file via the system's file
            // browser.
            Intent intent = new Intent(Intent.ACTION_OPEN_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);

            // Filter to show only images, using the image MIME data type.
            // If one wanted to search for ogg vorbis files, the type would be "audio/ogg".
            // To search for all documents available via installed storage providers,
            // it would be "*/*".
            intent.setType("*/*");

            startActivityForResult(intent, READ_REQUEST_CODE);
        } else {
            Intent subActivity = new Intent(MainActivity.this, SelectFileActivity.class);
            subActivity.putExtra("action", SelectFileActivity.Actions.SelectFile);
            AnimationUtils.startActivityWithScale(this, subActivity, true, SELECT_FILE_CODE, view);
        }
    }
 
开发者ID:ujjwalagrawal17,项目名称:CodeCompilerApp,代码行数:24,代码来源:MainActivity.java

示例5: selectPictureFromGallery

public void selectPictureFromGallery() {
    Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
    // 设置选择类型为图片类型
    intent.setType("image/*");
    // 打开图片选择
    startActivityForResult(intent, SELECT_GALLERY_PIC);

}
 
开发者ID:yuukidach,项目名称:Ucount,代码行数:8,代码来源:MainActivity.java

示例6: performFileSearch

private void performFileSearch() {
    Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    intent.setType("*/*");

    startActivityForResult(intent, READ_REQUEST_CODE);
}
 
开发者ID:e-regular-games,项目名称:arduator,代码行数:7,代码来源:MainActivity.java

示例7: openFileBrowser

private void openFileBrowser()
{
    String returnVal = new String();

    Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); //START INTENT TO CHOOSE FILE USING DEVICE' DEFAULT FILE BROWSER
    intent.addCategory(Intent.CATEGORY_OPENABLE);//SHOW ONLY FILES THAT CAN BE OPENED
    intent.setType("text/plain"); //only plain txt file can be accessed

    startActivityForResult(intent, READ_REQUEST_CODE);
}
 
开发者ID:FYP17-4G,项目名称:Aardvark,代码行数:10,代码来源:GUI_MainActivity.java

示例8: importBookmarks

/**
 * This method starts open document system activity.
 * @param activity
 */
@TargetApi(Build.VERSION_CODES.KITKAT)
public static void importBookmarks(Activity activity) {
    // choose a file via the system's file browser
    Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
    // show only results that can be "opened", such as a file
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    // filter to show only plain text
    intent.setType(MIME_TYPE);

    activity.startActivityForResult(intent, READ_REQUEST_CODE);
}
 
开发者ID:nfdz,项目名称:foco,代码行数:15,代码来源:ImportExportUtils.java

示例9: pickFromGallery

public void pickFromGallery(View v) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        startActivityForResult(new Intent(Intent.ACTION_GET_CONTENT).setType("image/*"),
                REQUEST_PICK_IMAGE);
    } else {
        Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        intent.setType("image/*");
        startActivityForResult(intent, REQUEST_KITKAT_PICK_IMAGE);
    }
}
 
开发者ID:chenliguan,项目名称:Android-BitherCompress-master,代码行数:11,代码来源:MainActivity.java

示例10: performFileSearch

@TargetApi(Build.VERSION_CODES.KITKAT)
private void performFileSearch() {
    Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);

    intent.addCategory(Intent.CATEGORY_OPENABLE);
    intent.setType("*/*");
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);

    startActivityForResult(intent, READ_REQUEST_CODE);
}
 
开发者ID:iTXTech,项目名称:Daedalus,代码行数:11,代码来源:RuleConfigFragment.java

示例11: moveToGallery

protected void moveToGallery() {
    Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
    intent.setType("video/mp4");
    startActivityForResult(intent, 1000);
}
 
开发者ID:Tai-Kimura,项目名称:VideoApplication,代码行数:5,代码来源:VideoPlayActivity.java

示例12: addPicture

private void addPicture() {
    Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    intent.setType("image/*");
    startActivityForResult(intent, SELECT_IMAGE);
}
 
开发者ID:cache117,项目名称:social-journal,代码行数:6,代码来源:MainActivity.java

示例13: openSAF

public static void openSAF(Activity context) {

        Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        context.startActivityForResult(intent, 42);

    }
 
开发者ID:htqqdd,项目名称:music_player,代码行数:7,代码来源:RecommendFragment.java


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