Method not calling alert class
<p>I have an Alert method set in the main class. Which is then called in an onclick within the main class like: </p>

<pre><code>alertbox.show();
</code></pre>

<p>I am going to need a few alert dialogs to set validation within my app. </p>

<p>I have the alertdialog code as: </p>

<pre><code>final AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
    alertDialog = new AlertDialog.Builder(this).create();
    alertbox.setTitle("Warning");
    alertbox.setMessage("Game May End");
    alertbox.setPositiveButton("CONTINUE",
            new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    setContentView(webview);


                }
            });

    alertbox.setNegativeButton("CANCEL",
            new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {

                }
            });

    alertbox.setIcon(R.drawable.icon);
</code></pre>

<p>having a few alert dialogs on top of what I already have in the main class makes the class too big. I would like to seperate the class into a mainvalidation class. Then call this alert dialog in the main class as </p>

<pre><code>mainvalidation.alertbox.show();
</code></pre>

<p>Can someone please help me with this. Thanks</p>

<p>Edit:</p>

<p>I have tried putting it into another class and adding static. But it says only final is permitted alertbox shows an error when I use static:</p>

<pre><code>        public class MainValidation extends Activity {

    static AlertDialog alertbox;
    static AlertDialog alertDialog; 

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        final static AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
            alertDialog = new AlertDialog.Builder(this).create();

        alertbox.setTitle("Warning");
        alertbox.setMessage("Game May End");
        alertbox.setPositiveButton("CONTINUE",
                new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {



                    }
                });

        alertbox.setNegativeButton("CANCEL",
                new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                    }
                });

        alertDialog.setIcon(R.drawable.icon);


}
}
</code></pre>

<p>Please help, thanks</p>
