Back to project page app_syncit.
The source code is released under:
MIT License
If you think the Android project app_syncit listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.feality.app.syncit; /*from w ww . j a v a 2 s.co m*/ import android.content.Context; import android.database.Cursor; import android.net.Uri; import java.net.URISyntaxException; /** * Created by Filip on 2014-09-11. */ public class FileUtils { public static String getPath(Context context, Uri uri) throws URISyntaxException { if ("content".equalsIgnoreCase(uri.getScheme())) { String[] projection = { "_data" }; Cursor cursor = null; try { cursor = context.getContentResolver().query(uri, projection, null, null, null); int column_index = cursor.getColumnIndexOrThrow("_data"); if (cursor.moveToFirst()) { return cursor.getString(column_index); } } catch (Exception e) { // Eat it } } else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } }