2012-01-17 80 views
1

我从图库中获取图片到我的应用程序。它适用于我的设备(平板电脑,手机)中的照片。当照片来自“云端”,即我的Google相册/ Picasa时,它不起作用。从图库中加载ImageView上的图像(图片来自我的Google相册)

下面是我在做什么:

fotoPaciente.setOnClickListener(new OnClickListener() { 
     @Override 
      public void onClick(View v) { 
      // To open up a gallery browser 
       Intent photoPickerIntent = new Intent(); 
       photoPickerIntent.setType("image/*"); 
       photoPickerIntent.putExtra("crop", "true"); 
       //photoPickerIntent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri()); 
       photoPickerIntent.putExtra("outputFormat", 
       Bitmap.CompressFormat.JPEG.toString()); 

       photoPickerIntent.setAction(Intent.ACTION_GET_CONTENT); 
       startActivityForResult(Intent.createChooser(photoPickerIntent, "Selecione uma imagem"),1); 

      } 


    }); 

这里是我的活动结果:

 public void onActivityResult(int requestCode, int resultCode, Intent data) { 

      if (resultCode == RESULT_OK) { 

        if (requestCode == 1) { 

          // currImageURI is the global variable I'm using to hold the content:// URI of the image 
          currImageURI = data.getData(); 
          fotoPaciente.setImageURI(currImageURI); 
          String pathFoto = currImageURI.getPath(); 

         if (pathFoto.startsWith("/external")) { 
          pathFoto = getFilePathFromUri(currImageURI); 
         } 



        } 
      } 
    } 

正如我所说的,它工作得很好位于我的设备中的图片。

回答

1

查看Picasa API Here