2011-11-07 94 views
-1

我正在开发一个联系人应用程序。我想将联系人图像显示给我的自定义列表视图。我想从该联系人图像获取Inputstream以写入SD卡。我怎么才能得到它 ?如何从位图图像文件获取inputstream?

任何帮助表示赞赏。

+0

请检查下面的链接,希望这将有助于ü: http://stackoverflow.com/questions/3280308/open-a-bitmap-with-inputstream – Maneesh

+0

但我的图像文件没有存储在SD卡或内存中。 –

回答

0

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; 
    } 
}