Java tutorial
//package com.java2s; import android.content.Context; import android.net.Uri; import java.util.List; public class Main { private static final String PATH_DOCUMENT = "document"; private static boolean isDocumentUri(Context context, Uri uri) { final List<String> paths = uri.getPathSegments(); if (paths.size() < 2) { return false; } if (!PATH_DOCUMENT.equals(paths.get(0))) { return false; } return true; } }