本文整理汇总了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);
}