本文整理匯總了Java中android.content.Intent.ACTION_OPEN_DOCUMENT_TREE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Intent.ACTION_OPEN_DOCUMENT_TREE屬性的具體用法?Java Intent.ACTION_OPEN_DOCUMENT_TREE怎麽用?Java Intent.ACTION_OPEN_DOCUMENT_TREE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.content.Intent
的用法示例。
在下文中一共展示了Intent.ACTION_OPEN_DOCUMENT_TREE屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getDocTreeIntent
public static Intent getDocTreeIntent()
{
if (isMarshMallowOrLater())
{
return new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
}
return null;
}
示例2: onOpenBrowser
private void onOpenBrowser() {
boolean browserStarted = false;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
/*
* Apparently some devices do not handle this intent.
* Fallback to internal browser.
*/
try {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
getActivity().startActivityForResult(intent, ReposActivity.ACTION_OPEN_DOCUMENT_TREE_REQUEST_CODE);
browserStarted = true;
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
}
if (! browserStarted) {
Activity activity = getActivity();
if (activity != null) {
/* Close the keyboard before opening the browser. */
ActivityUtils.closeSoftKeyboard(getActivity());
/* Open internal browser. */
((CommonActivity) activity).runWithPermission(
AppPermissions.Usage.LOCAL_REPO,
this::startBrowserDelayed
);
}
}
}
示例3: openSAF
public static void openSAF(Activity context) {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
context.startActivityForResult(intent, 42);
}
示例4: openTreePicker
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void openTreePicker(Activity activity) {
Intent i = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
i.putExtra("android.content.extra.SHOW_ADVANCED", true);
activity.startActivityForResult(i, SAFUtil.REQUEST_SAF_PICK_TREE);
}