Bummer! You must be logged in to access this page.

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

Recipients Activity onListItemClick "cannot resolve method" what do i do? (android studio)

when Ben types onListItemClick a @override method is auto generated for him. Mine will not auto generate and will be underlined in red.

I think this has to do with the fact i have to extend ActionBarActivity instead of ListActivity for the action bar fix in android studio.

I tried doing mListview = (ListView) findViewById(R.id.receipientsListView); and doing mListView.onListItemClick but it is still red:(

please add code block. have to say code Ben working on is a special code for ListActivity so it wont work the same way in other activities.

You have to do

    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> l, View view, int position, long id) {

            if (mListView.getCheckedItemCount() > 0) {
                mSendMenuItem.setVisible(true);
            }
            else {
                mSendMenuItem.setVisible(false);
            }
        }
    });