1

I have a problem in this code. I need to execute the code in the listView.setOnItemClickListener() but the program not enter in this function.
Any ideas?

adapter = new CustomerListAdapter(Activity.this);

ListView listView = (ListView) findViewById(R.id.listView1);
listView.setAdapter(adapter);

listView.setOnItemClickListener(new OnItemClickListener() {
    public void onItemClick(AdapterView<?> a, View v, int position, long id) {
        Intent intent = new Intent(Activity.this, DetailActivity.class);
        intent.putExtra("sk", adapter.getSK(position));
        Activity.this.startActivityForResult(intent, REQUEST_DETAIL);
    }
});
Renjith
  • 5,783
  • 9
  • 31
  • 42
hasmet
  • 758
  • 3
  • 13
  • 32

1 Answers1

2

Try the following:

ListView listView = (ListView) findViewById(R.id.listView1);
listView.setItemsCanFocus(false);

Also make sure you add the following code for every clickable object inside your list view items.

android:focusable="false"
android:focusableInTouchMode="false"
Korhan Ozturk
  • 11,148
  • 6
  • 36
  • 49