Putting LinearLayout to LinearLayout Array
<p>i wanna create button 1 to 9 and i want to do that in loop. But in each 3 count, i want to create a new LinearLayout.</p>

<pre><code>  final LinearLayout[] ll2 = new LinearLayout[10]; // create an empty array;


            for(int i=1; i&lt;=9;i++)
            {
                Button btnNums = new Button(this);
            final LinearLayout[] ll2 = new LinearLayout[10]; // create an empty array;


            for(int i=1; i&lt;=9;i++)
            {
                Button btnNums = new Button(this);
                btnNums.setText(i+"");
                ll.addView(btnNums);
                if(i%3==0){
                    ll2[i] = ll;
                    ll = null;

                }
            }

            layout.addView(ll2[0]);

    btnNums.setText(i+"");
            ll.addView(btnNums);
            if(i%3==0){
                ll2[i] = ll;
                ll = null;

            }
        }

        layout.addView(ll2[0]);
</code></pre>

<p>This does not work. I get no error but when o run the app, it is stopped to work. What's the problem?</p>
