hi.

i want a Click event of Listview Item means i have Listview in that
one TextView and ImagView is there so i want to know Click event of
the ImageView .

But right now i When i click in ImagView than First listview is
selected and aftare second Click i get Click Event of Imgaview.But i
want a ClickEvent of ImagView when i First Click on the ImagView. so
can any body help me on this topic.....


here is my code.....

package jaimin.android.listview;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;


/**
 * A list view example where the
 * data for the list comes from an array of strings.
 */
public class listview extends Activity implements OnItemClickListener
{
        //private ImageView imgview;
        ListView listview;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        listview = (ListView)findViewById(R.id.listview);
        // Use an existing ListAdapter that will map an array
        // of strings to TextViews

        listview.setAdapter(new ArrayAdapter<String>(this,
                R.layout.setting,R.id.text, mStrings));
        listview.setTextFilterEnabled(true);
        listview.setBackgroundColor(0XFFFFFFFF);
        listview.setClickable(false);
        listview.setFocusable(false);
        listview.setOnItemClickListener(this);
                listview.setOnItemClickListener(new OnItemClickListener
(){

                                   @SuppressWarnings("unchecked")
                                   public void onItemClick(AdapterView<?>
parent, View v, int position,long id) {

                                       // TextView deleteIcon = (TextView)
v.findViewById(R.id.LIST_DELETE_ICON);
                                           ImageView imgview = (ImageView)
v.findViewById(R.id.imgview);
                                        if(imgview != null)
                                        {
                                             imgview.setOnClickListener(new
OnClickListener(){
                                                 public void onClick(View v)
{
                                                         Toast.makeText
(listview.this,"hi it works", Toast.LENGTH_LONG).show();
                                                 }
                                            });
                                       } else {
                                           Log.i("DELETEICON","Sorryy...
NULL!!!!!!!!");
                                       }
                                  }});
    }

    private String[] mStrings = {
            "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam"};

        }

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to