2011-11-07 77 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; 
    } 
}