Skip to content Skip to sidebar Skip to footer

View File Path In A File Manager As Android Intent

Just so you know, I've already checked both the Android developer documentation and OpenIntents, without finding an answer. I might easily have missed something, though. Is there

Solution 1:

I have the following ...

        Intent intent = new Intent();
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        intent.setType("text/csv");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent, getText(R.string.select_file)),1);

and then onActivityResult()

        currFileURI = data.getData();
        filename_editText.setText(currFileURI.getPath());

UPDATE: SOLUTION:

publicstaticbooleanisUriAvailable(Context context, String uri) {
    Intent test = newIntent(Intent.ACTION_VIEW, Uri.parse(uri));
    return context.getPackageManager().resolveActivity(test, 0) != null;
}

Post a Comment for "View File Path In A File Manager As Android Intent"