user1400538
user1400538

Reputation: 865

FocusChangeListener not working

I have six imageViews in my gridview. I am trying to get the focus changed events for thes imageviews using the following code; but this does not work when I change the focus. Can someone please let me know why and the solution for the same. Any help is much appreciated

gridView.setOnFocusChangeListener(new AdapterView.OnFocusChangeListener() {
        //@Override
        public void onFocusChange(View arg0, boolean arg1) {
            Log.d("MyTestActivity", "View:" + arg0.getId() + " boolean = " + arg1);
        }
    });

Upvotes: 1

Views: 1924

Answers (1)

dilix
dilix

Reputation: 3893

Following code only works when focus cnahge on the whole gridview - if you want to listen for the focus on each imageView - you have to set listeners on each of it. But i think you maybe want something like onItem...Listener ? What goals are you want to achieve ?

Upvotes: 1

Related Questions