Should setOnItemClickListener <http://developer.android.com/reference/android/widget/AdapterView.html#setOnItemClickListener%28android.widget.AdapterView.OnItemClickListener%29>(AdapterView.OnItemClickListener <http://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html> listener) be used instead? Also, should the activity implement AdapterView.OnItemClickListener and not View.OnClickListener?

David Fire wrote:
hi
i cant press any item on my listview nor in the emulator nor in a real phone.


item layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"; android:id="@+id/LinearLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <CheckBox android:id="@+id/RuleEnable" android:text="" android:layout_width="wrap_content" android:layout_height="wrap_content" ></CheckBox> <TextView android:id="@+id/RuleName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:focusable="true" ></TextView> </LinearLayout>

listview layout
<ListView android:id="@+id/Listado" android:layout_width="fill_parent" android:layout_height="250px" android:isScrollContainer="true" android:drawSelectorOnTop="false" android:choiceMode="singleChoice"></ListView>

some code
public class GuiActivity extends Activity implements View.OnClickListener,
OnItemClickListener{
.... //lista means list in spanish
        lista = (ListView)findViewById(R.id.Listado);
        RuleList = new ArrayList<SMSRule>();
        loadRuleList();
        adapter=new SMSRuleAdaptor(this,RuleList);
        lista.setAdapter(adapter);
        lista.setOnItemClickListener(this);


this method is never called
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long id) {
        enable.setText("id: "+id);
}



--
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.

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

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

Reply via email to