George32x
George32x

Reputation: 1

ListView with different actions according to View

I want to make a listview with two image views in it and two different actions for the listener case the image the user touches.So this is my code

l1.setOnItemClickListener(new OnItemClickListener() {

    public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
            long arg3) {
        switch(arg1.getId()) {
        case R.id.addView :
        //do this
            break;
        case R.id.imageView1 :              
        //do this
            break;
        } 

Upvotes: 0

Views: 234

Answers (1)

tacone
tacone

Reputation: 11451

You need to make those images clickable with setClickable and set an OnClickListener on each.

When something inside a ListView item is interactive then it will steal the click event to its parent.

Upvotes: 1

Related Questions