Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Implementing Designs for Android Updating Other GridViews Selecting GridView Items

Manfredi Martorana
Manfredi Martorana
19,470 Points

Problem with the OnClickListener

It seems that the onItemClick method of the gridView listener is deprecated, now instead we have OnClick.

How do I adapt the code?

Thanks :)

1 Answer

Jacob Bergdahl
Jacob Bergdahl
29,119 Points

I just tried it today and it seems to be working for me. Try this!

protected AdapterView.OnItemClickListener mOnItemClickListener = new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // code emitted
        }
    };