2011-11-10 83 views
-1

在我的应用程序,我可以通过startActivityForresult();通过代码如何在列表视图中显示选定的图像?

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

访问画廊现在我可以选择图像的URI。我在ArrayList<String> imageList中添加URI,我想通过另一个Activity在ListView中显示图像。 请帮忙?

+0

请更清楚您的问题。我不明白你的问题。 – Arslan

+0

我想从图库中选择图像并将其显示在列表视图中。 – Sandroid

+0

我现在得到了。您是否希望分享您在ListAdapter中使用的getView()方法代码? – Arslan

回答

0

我认为你可以在列表发送到另一个ActivityListView把它公开要在分配Image to ImageView不喜欢这样被Accesed从另一个活动

Adapter's getView方法,

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); 
相关问题