Hello

I have an application with an activity in which there is a listview
that shows imageviews with textviews in each row. The fact is that
when I click on any of the images of listview always opens the last
image that has entered the listview (above or below). Does anyone know
how to make it open for the thumbnail image on which I am pressing?
The section of code that manages the listview getView is:

//************************************************
*****************************
        @Override
                public View getView(int position, View convertView, ViewGroup
parent) {
                        View v;
                        final ViewHolder holder;

                        //try{

                        //Asigna al listview el layout single_item
                                v = convertView;
                                try{
                                if (v == null) {
                                        LayoutInflater vi = (LayoutInflater)
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                                        v = 
vi.inflate(R.layout.single_item_recuperados, null);

                                        holder = new ViewHolder();
                                holder.i = (ImageView) 
v.findViewById(R.id.iconolista);
                                holder.Nombre = (TextView)
v.findViewById(R.id.NombreArchivo);
                                holder.Tamano = (TextView)
v.findViewById(R.id.TamanoArchivo);
                                holder.RutaThumbnail = (TextView)
v.findViewById(R.id.RutaThumbnail);
                                v.setTag(holder);
                                }
                                else
                                {
                                        holder = (ViewHolder) v.getTag();

                                }

                                 try{
                                         datos = items.get(position);
                                 }catch (NullPointerException npe)
{ System.out.println("Items.get(position) esta dando NULL"); }
......
......
......

/ / at the end of getView I have ....


holder.i.setOnClickListener(new OnClickListener() {
                        @Override
                                public void onClick(View v) {


                                        Intent intent = new Intent();
                                       
intent.setAction(android.content.Intent.ACTION_VIEW);
                                       File file = new File(ruta);
                                       
intent.setDataAndType(Uri.fromFile(file), "image/*");
                                       startActivity(intent);
                         }
                        });



Any ideas?

Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to