What if you don't want to create dozen classes for AlertDialogs?
<p>I have many different states according to which I need to feedback to User with a message in form of <code>AlertDialog</code>. It's just insane to create a separate class for each alert. What I have now is: </p>

<pre><code>class FeedbackAlertDialog extends DialogFragment {
    private String message;
    private int action;

    FeedbackAlertDialog() {
    }

    FeedbackAlertDialog(String message, int action) {
        this.message = message;
        this.action = action;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        return new AlertDialog.Builder(getActivity())
                .setCancelable(false)
                .setTitle(message)
                .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        switch (action) {
                            case action: // It's impossible because the int should be final
                        }
                        startActivity(new Intent(getActivity(), MainActivity.class));
                    }
                }).show();
    }
}
</code></pre>

<p>The problem is that I can't use <code>switch</code> because <code>int</code> should be final. How to come up with this situation?</p>
