0

In new android version, they have added gplus photo section in gallery.

In my application, i have incorporated the logic of selecting image from it and display to the user using below link of stackoverflow:

Download image from new Google+ (plus) Photos Application

However, i also need image extension as we are sending image raw data with extension of selected picture to the API. gplus returns the image path like this

content://com.google.android.apps.photos.content/0/https%3A%2F%2Flh5.googleusercontent.com%<a bunch of letters and numbers here>

So, how can i get extension of that image also from gplus?? Any idea??

I AM SUCCESSFULLY GETTING BITMAP FROM ABOVE URI. I JUST NEED EXTENSION OF THAT IMAGE NOW.

Thanks.

Community
  • 1
  • 1
Ripal Tamboli
  • 562
  • 1
  • 4
  • 16

1 Answers1

5

Use ContentResolver.getType(uri):

Uri uri = // your content://com.google.android.apps.photos.content URI
String mimeType = getContentResolver().getType(uri);
// mimeType will be image/png, image/jpeg, etc.
ianhanniballake
  • 191,609
  • 30
  • 470
  • 443