【问题标题】:How to get inputstream from bitmap image file?如何从位图图像文件中获取输入流?
【发布时间】:2011-11-07 05:13:27
【问题描述】:

我正在开发一个联系人应用程序。我想向我的自定义列表视图显示联系人图像。我想从该联系人图像中获取 Inputstream 以写入 sdcard 。我怎样才能得到它?

感谢任何帮助。

【问题讨论】:

标签: android bitmap inputstream


【解决方案1】:

documentation here逐字复制:

 public InputStream openDisplayPhoto(long photoFileId) {
     Uri displayPhotoUri = ContentUris.withAppendedId(DisplayPhoto.CONTENT_URI, photoKey);
     try {
         AssetFileDescriptor fd = getContentResolver().openAssetFileDescriptor(
             displayPhotoUri, "r");
         return fd.createInputStream();
     } catch (IOException e) {
         return null;
     }
 }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多