Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Implementing Designs for Android Updating Other GridViews Updating the Recipients Activity

Now add an else condition where you reset the visibility to invisible

I dont know where I'm getting it wrong

InviteActivity.java
import android.app.Activity;
import android.os.Bundle;
import android.view.ListView;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.TextView;

public class InviteActivity extends Activity {

    /*
     * Some code has been omitted for brevity!
     */
    public MenuItem mInviteMenuItem;
    public GridView mGridView;
    public TextView mEmptyTextView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.player_grid);

        mGridView = (GridView)findViewById(R.id.gridView);
        mGridView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
        mGridView.setOnItemClickListener(mOnItemClickListener);
    }

    public OnItemClickListener mOnItemClickListener = new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            // Start by adding code in here!

          if (mGridView.getCheckedItemCount()> 0) {
            mInviteMenuItem.setVisibility(0);
          }
          else{
            mInviteMenuItem.setVisibility(1); }

        }       
    };
}