@@ -0,0 +1,2693 @@
+package colector.co.com.collector.utils;%0A%0Aimport android.annotation.SuppressLint;%0Aimport android.content.Context;%0Aimport android.database.Cursor;%0Aimport android.net.Uri;%0Aimport android.os.Build;%0Aimport android.provider.DocumentsContract;%0Aimport android.provider.MediaStore;%0Aimport android.support.v4.content.CursorLoader;%0A%0A/**%0A * @author http://hmkcode.com/android-display-selected-image-and-its-real-path/%0A * @version 1.0%0A */%0A%0Apublic class RealPathUtil %7B%0A%0A    public static String getRealPathFromUri(Context context, Uri uri) %7B%0A        if (Build.VERSION.SDK_INT %3C 11) return getRealPathFromURI_BelowAPI11(context, uri);%0A        if (Build.VERSION.SDK_INT %3C 19) return getRealPathFromURI_API11to18(context, uri);%0A        return getRealPathFromURI_API19(context, uri);%0A    %7D%0A%0A    @SuppressLint(%22NewApi%22)%0A    public static String getRealPathFromURI_API19(Context context, Uri uri) %7B%0A        String filePath = %22%22;%0A        String wholeID = DocumentsContract.getDocumentId(uri);%0A%0A        // Split at colon, use second item in the array%0A        String id = wholeID.split(%22:%22)%5B1%5D;%0A%0A        String%5B%5D column = %7BMediaStore.Images.Media.DATA%7D;%0A%0A%0A        // where id is equal to%0A        String sel = MediaStore.Images.Media._ID + %22=?%22;%0A%0A        Cursor cursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,%0A                column, sel, new String%5B%5D%7Bid%7D, null);%0A%0A        int columnIndex = cursor.getColumnIndex(column%5B0%5D);%0A%0A        if (cursor.moveToFirst()) %7B%0A            filePath = cursor.getString(columnIndex);%0A        %7D%0A        cursor.close();%0A        return filePath;%0A    %7D%0A%0A%0A    @SuppressLint(%22NewApi%22)%0A    public static String getRealPathFromURI_API11to18(Context context, Uri contentUri) %7B%0A        String%5B%5D proj = %7BMediaStore.Images.Media.DATA%7D;%0A        String result = null;%0A%0A        CursorLoader cursorLoader = new CursorLoader(%0A                context,%0A                contentUri, proj, null, null, null);%0A        Cursor cursor = cursorLoader.loadInBackground();%0A%0A        if (cursor != null) %7B%0A            int column_index =%0A                    cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);%0A            cursor.moveToFirst();%0A            result = cursor.getString(column_index);%0A        %7D%0A        return result;%0A    %7D%0A%0A    public static String getRealPathFromURI_BelowAPI11(Context context, Uri contentUri) %7B%0A        String%5B%5D proj = %7BMediaStore.Images.Media.DATA%7D;%0A        Cursor cursor = context.getContentResolver().query(contentUri, proj, null, null, null);%0A        int column_index%0A                = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);%0A        cursor.moveToFirst();%0A        return cursor.getString(column_index);%0A    %7D%0A%7D

Add helper class to retrive real uri path from picked image