2014-02-20 39 views
0

在新的Android版本中,他們在圖庫中添加了gplus照片部分。從新的Google+(加)下載圖片帶有圖像擴展的圖庫

在我的申請,我已併入選擇圖像的邏輯從它和顯示使用下面計算器的鏈接的用戶:

Download image from new Google+ (plus) Photos Application

然而,我還需要圖像擴展,因爲我們正在發送圖像將選定圖片擴展到原始數據的原始數據。 gplus返回像這樣的圖像路徑

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

那麼,我怎樣才能得到該圖像的擴展也gplus?任何想法??

我成功地從上述URI獲取位圖。我現在只需要擴展這個圖像。

謝謝。

回答

5

使用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. 
+0

很多很多的感謝@ianhanniballake。讓我試試並儘快更新。 :) –

+0

非常感謝。有效。讓我接受這個答案。 :) –

相關問題