Visualização de arquivos da intenção do Google Drive para Android
Se alguém puder ajudar, eu seria realmente incrível. Eu estou construindo um aplicativo onde por eu estou tentando acessar meus arquivos e exibi-los em um imageview.
Eu tenho um botão e para isso eu anexar um onClickListener
iButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
photoPickerIntent.setType("image/*");
startActivityForResult(Intent.createChooser(photoPickerIntent, "Select Picture"), 1);
}
});
A intenção me dá 3 opções Gallery, Dropbox e Google Drive
Para o Gallery eu consigo acessar o arquivo e visualizá-lo no imageview
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
imageHolder.setImageBitmap(BitmapFactory.decodeFile(picturePath));
Para o Dropbox eu faço assim
imageHolder.setImageBitmap(BitmapFactory.decodeFile(selectedImage.getPath()));
No entanto, eu não tenho certeza de como fazê-lo para o Google Drive eu tentei fazê-lo como a galeria, mas eu recebo o seguinte erro
E / BitmapFactory: Não é possível decodificar o fluxo: java.io.FileNotFoundException: /: open failed: EISDIR (É um diretório)
Qualquer ajuda será muito apreciada.