Java tutorial
//package com.java2s; //License from project: Apache License import android.annotation.SuppressLint; import android.net.Uri; import android.provider.DocumentsContract; public class Main { @SuppressLint("NewApi") public static String getRealPathFromUriApi21(Uri uri) { return DocumentsContract.getDocumentId(uri); } }