Download image from new Google+ (plus) Photos Application

后端 未结 3 1001
独厮守ぢ
独厮守ぢ 2020-12-09 08:06

Recently Google added the Photos app for Google+ (plus) and it shows up when you launch an Intent to choose an image. However, if I select an image from Google+ Photos and t

3条回答
  •  不思量自难忘°
    2020-12-09 08:52

    When receiving the data intent, you should use the contentResolver to get the photos. Here's what you should do:

    String url = intent.getData().toString();
    Bitmap bitmap = null;
    InputStream is = null;
    if (url.startsWith("content://com.google.android.apps.photos.content")){
           is = getContentResolver().openInputStream(Uri.parse(url));
           bitmap = BitmapFactory.decodeStream(is);
    }
    

提交回复
热议问题