it works perfectly on other phones, the problem is only with Nokia
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
activity.startActivityForResult(intent, CODE_REQUEST_OPEN_DOCUMENT_TREE);
it works perfectly on other phones, the problem is only with Nokia
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
activity.startActivityForResult(intent, CODE_REQUEST_OPEN_DOCUMENT_TREE);
it shows because your device hase no application for reading documents put code as below for checking it
intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
try {
activity.startActivityForResult(intent, requestCode);
return;
} catch (ActivityNotFoundException anfe) {
Log.w(TAG, "couldn't complete ACTION_OPEN_DOCUMENT, no activity found. falling back.");
}
you can check more clearly by link2
Using Different type of Chooser to select document type. It is easy to use in android check Below code.
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
String[] mimetypes = {"application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/msword"};
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
startActivityForResult(intent, REQUEST_CODE_OPEN);
Check if at least one activity exists to handle that Intent:
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
if (intent.resolveActivity(context.getPackageManager()) != null) {
activity.startActivityForResult(intent, CODE_REQUEST_OPEN_DOCUMENT_TREE);
}