Android : Refresh GridView in Fragment
<p>I'm sorry if my question seems common. I have google and have many results, but none of them I can apply.</p>

<p>I have a fragment that uses <code>GridView layout</code>. I also use <code>BaseAdapter</code> for my gridview.</p>

<p>When the data changes, I call <code>gridView.invalidateViews();</code> but gridview doesn't redraw with new data.</p>

<pre><code>gridView.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) {
                               getTable(position).setStatus("busy");   // change data 
                               gridView.invalidateViews(); // and redraw
                }
</code></pre>

<p>Or, I do another way:</p>

<pre><code> @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.waiter_view_fragment, container, false);

    gridView = (GridView) (rootView).findViewById(R.id.waiterGridView);
    gridView.setAdapter(new ImageAdapterHost(this, getActivity())); 
        // Add this line here
        ((BaseAdapter)gridView.getAdapter()).notifyDataSetChanged();
    }
</code></pre>

<p>The answer still be same. My gridview doesn't redrawn, although when I test data, the data really changes, but dont update my gridview.</p>

<p>Please teach me how to redraw gridview fragment after  data change.</p>

<p>Thanks :)</p>
