How to check whether GridView is Empty or not in Android?
<p>I have add buttons in <code>GridView</code> using base adapter, that buttons depend on word length when click the button then hide. After clicking all buttons the <code>GridView</code> is make empty i want to check, if <code>GridView</code> is Empty Display another buttons. I want to check whether <code>GridView</code> is empty or not in <code>GridViewActivity.java</code></p>

<p>Here is the code.</p>

<p>GridViewActivity.java</p>

<pre><code>public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.spellword);

        txt=(TextView)findViewById(R.id.txtview);
        image=(ImageView)findViewById(R.id.imgview1);

        map.put("melon", R.drawable.melon);
        image.setImageResource(map.get("melon"));


        gridView=(GridView)findViewById(R.id.grid1);
        gridView.setAdapter(new SpellAdapter(this,words,word));

        detector = new SimpleGestureFilter(this, this);

    }
</code></pre>

<p>SpellAdapter.java</p>

<pre><code>public class SpellAdapter extends BaseAdapter{

    public Context context;
    public char[] word;

    public SpellAdapter(Context context, char[] word, String orglWord)
    {
        this.context=context;
        this.word=word;

    }

    public int getCount() {
        count=word.length;
        return count;
    }

    public Object getItem(int position) {

        return null;
    }

    public long getItemId(int position) {

        return 0;
    }


    public View getView(final int position, View convertView, ViewGroup arg2) {

        View v = convertView;
        if (v == null) 
        {  
             LayoutInflater vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             v = vi.inflate(R.layout.buttonlist, null);
        } 

        final Button btn= (Button)v.findViewById(R.id.letterbtn);

        btn.setText(word[position]+"");

        btn.setOnClickListener(new OnClickListener(){

            public void onClick(View v) 
            {
                letters=btn.getText();
                String word = letters.toString();
                btn.setVisibility(View.GONE);

            }


        });

        return v; 
    }




}
</code></pre>
