• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How to get file path from Google Drive

danmacleod

Newbie
Mar 16, 2018
14
0
I'm retrieving the path to an image from a Uri and saving the path in one of my domain objects for future use. This works fine for images stored on the local device by using a cursor (see below) . However, I'm not sure how to get the file path when the image is stored on my Google drive. The Uri below is an example. I've seen many posts about this issue but I haven't found a solution. Any ideas?

Code:
content://com.google.android.apps.docs.storage/document/acc%3D1%3Bdoc%3D3890

Code:
cursor = context.getContentResolver().query( uri, projection, selection, selectionArgs, null );
if ( cursor != null && cursor.getCount() >= 1 && cursor.moveToFirst() ) {
    final int index = cursor.getColumnIndexOrThrow( column );
    return cursor.getString( index );
}
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones