當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。