2011-11-10 12 views
-1

私が選択した画像のURIを取得することができますstartActivityForresult();を通じて、今のコードlistviewで選択した画像を表示する方法は?私のアプリで

Intent intent = new Intent(); 
intent.setType("image/*"); 
intent.setAction(Intent.ACTION_GET_CONTENT); 
startActivityForResult(Intent.createChooser(intent,"Select Picture"), SELECT_PICTURE); 

てギャラリーにアクセスすることができます。 ArrayList<String> imageListにURIを追加して、別のアクティビティでListViewに画像を表示したいとします。 助けてください?

+0

あなたの質問でもっと明確にしてください。わたしはあなたの質問がわからなかった。 – Arslan

+0

ギャラリーから画像を選択し、リストビューに表示したいと考えています。 – Sandroid

+0

私は今得ました。 ListAdapterで使用されているgetView()メソッドコードを共有したいですか? – Arslan

答えて

0

私は、あなたがこのようにそれを行うImage to ImageViewを割り当てながら別のアクティビティ

からとAdapter's getView方法でAccesedするには、公開するListViewで別のActivityにそのリストを送信することができると思い

Uri contentUri = imageList.get(position); 
String[] proj = { MediaStore.Images.Media.DATA }; 
Cursor cursor = managedQuery(contentUri, proj, null, null, null); 
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); 
cursor.moveToFirst(); 
String tmppath = cursor.getString(column_index); 

Bitmap imaage = BitmapFactory.decodeFile(tmppath); 
imageView.setImageBitmap(image); 
関連する問題