【发布时间】:2015-05-13 05:36:43
【问题描述】:
在我的 android 应用程序中,我使用 Google 驱动器来挑选图像和文件,因为我的代码大部分时间都可以正常工作。不幸的是,在某些情况下图像导入不起作用,图像位图返回空值,下面是我用来将内容 URI 转换为输入流和位图的代码。
Bitmap bitmap = null;
InputStream input = null;
try {
input = getActivity()
.getContentResolver()
.openInputStream(
Uri.parse("content://com.google.android.apps.docs.storage/document/acc%3D2%3Bdoc%3D83"));
Log.Logger()
.finest("Profileimagefile Fragment Drive called input" + input);
bitmap = BitmapFactory
.decodeStream(input);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
我提到的 URI 不起作用,请帮助我找出问题所在。
【问题讨论】:
标签: android image google-drive-api