CopyPastor

Detecting plagiarism made easy.

Score: 0.8016526103019714; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2015-12-02
by Yksh

Original Post

Original - Posted on 2010-08-05
by Miša Peić



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Try something similar to this :
public String getRealPathFromURI(Context context, Uri contentUri) { Cursor cursor = null; try { String[] proj = { MediaStore.Images.Media.DATA }; cursor = context.getContentResolver().query(contentUri, proj, null, null, null); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } finally { if (cursor != null) { cursor.close(); } } }


Refer : https://stackoverflow.com/a/3414749/3891036
**Below API 19** use this code to get File Path from URI:
public String getRealPathFromURI(Context context, Uri contentUri) { Cursor cursor = null; try { String[] proj = { MediaStore.Images.Media.DATA }; cursor = context.getContentResolver().query(contentUri, proj, null, null, null); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } finally { if (cursor != null) { cursor.close(); } } }

        
Present in both answers; Present only in the new answer; Present only in the old answer;