How to add value to gridview
<p>I need add data to gridview table, when button is click. My code: </p>

<pre><code>    String[] data = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"};
    GridView gvMain;
    ArrayAdapter&lt;String&gt; adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.smena); 
          adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.item, R.id.tvText, data);
                gvMain = (GridView) findViewById(R.id.gridView1);
                gvMain.setAdapter(adapter);
           Button but1=(Button) findViewById(R.id.button1);
            but1.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View arg0) {

                     ButtonOn (1);
                }
            });
    }

    public void ButtonOn (int Art){
        adapter.add("1");
        gvMain.setAdapter(adapter);
    }
</code></pre>

<p>When I Click button, my application has stoped unexpectedly.</p>
