0

当我从 中单击图片时galleryview,我想显示从中选择的图片。我做了一个祝酒词,它给了我点击的图片,但我想在另一个活动中展示它。

我怎样才能做到这一点?

这是我的画廊活动。

 public View getView(int position, View convertView, ViewGroup parent) {   
                inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                View vi=convertView;   
                final Players players = getItem(position);


                if(convertView==null){  


                    vi = inflater.inflate(R.layout.pictures, null); 

                    ImageView image=(ImageView) vi.findViewById(R.id.imageView1);

                    TextView text1=(TextView)vi.findViewById(R.id.textView1);  
                    TextView text2=(TextView)vi.findViewById(R.id.textNom);
                    TextView text3=(TextView)vi.findViewById(R.id.textPost);
                    TextView text4=(TextView)vi.findViewById(R.id.textDdn);

                    text1.setText(players.getNm()); 
                    text2.setText(Html.fromHtml( players.getNom()).toString());
                    text3.setText(Html.fromHtml( players.getPost()).toString().replace("Ž", "é"));
                    text4.setText(players.getDdn());

                    imageLoader.displayImage(players.getImage()image,options);


                galleryView.setOnItemClickListener(new OnItemClickListener() {

                    @Override
                    public void onItemClick(AdapterView<?> arg0, View view, int position,long arg3) {
                        Toast.makeText(getApplicationContext(), players.getImage() , Toast.LENGTH_SHORT).show();

                    }
                });
            }

这就是我在其他活动中所做的,这让我有问题要展示它:

class ImageAdapter extends ArrayAdapter<Players> {

    public ImageAdapter(Context context, int textViewResourceId,List<Players> objects) {
        super(context, textViewResourceId, objects);
    }

    public View getView(int position, View convertView, ViewGroup parent) {   
        inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View vi=convertView;   

        Players players = getItem(position);

        if(convertView==null){  

            vi = inflater.inflate(R.layout.gallery_player, null); 

            imageLoader.displayImage(players.getImage(), img, options);
        }
        return vi;
    }
}
}
4

1 回答 1

1

有几种方法可以解决这个问题,我不确定你是如何设计数据的,
一个简单的解决方案,
你可以为所有带有图像 url 的 ImageView 设置标签,

 view.setTag(url)  

每当你点击imageview,你可以得到标签即ImageUrl,

  view.getTag()

将 url 发送到其他活动并读取位图并将其显示在 ImageView 中或您希望的背景中。

于 2013-06-03T10:27:20.197 回答