0
在我的代码后按下相机按钮onActivityResult
调用(作为意图的结果)。在这种方法中,我已经编写代码在listView
中添加捕获的图像。我想要的是,当我第二次拍摄图像时,listView
中的第一张图像不应该消失。如果我拍摄了三次图像,则应该有三个listview
项目。我的代码每次捕捉图像时只显示一个项目。我已经尝试了很多,无法弄清楚。 谢谢。追加摄像机图像在列表框中的ANdroid
ArrayList<HashMap<String, Object>> hashMapListForListView=new ArrayList<HashMap<String,Object>>();
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == Activity.RESULT_OK)
{
if (requestCode == take_image) {
//get image
final Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
Viewimage.setImageBitmap(thumbnail);
Adapter=new SimpleAdapter(this,hashMapListForListView,R.layout.imageview2,new String[]{"image"}, new int[]{R.id.imageView2});
HashMap<String, Object>temp11=new HashMap<String, Object>();
//Drawable d = new BitmapDrawable(getResources(),thumbnail);
temp11.put("image",thumbnail);
hashMapListForListView.add(temp11);
listviewattachment.setAdapter(Adapter);
Adapter.setViewBinder(new MyViewBinder());
Adapter.notifyDataSetChanged();
感谢帕雷什..它是working..can你告诉我怎样可以删除任何我不喜欢列表中的项目? – user2768215