• (Android)How will go to the nextpage after clicking an AlertDialog


    AlertDialog.Builder ab = new AlertDialog.Builder(context);
            ab.setMessage(msg);
            ab.setPositiveButton("OK", new OnClickListener() {
    
                @Override
                public void onClick(DialogInterface dialog, int which) {
    
                    Intent in=new Intent(context, ExportActivity.class);
                                context.startActivity(in);
                }
            });
            ab.create().show();
    Here context is your Activity context if you are writing Alert message in another class. If you have your alert message in same class so you can pass "this" in place of context.
    for same class replace
    Intent in=new Intent(context, ExportActivity.class);
            context.startActivity(in);
    by this
    Intent in=new Intent(CurrentActivity.this, ExportActivity.class);
                startActivity(in);
  • 0 comments:

    Post a Comment

    FAVOURITE LINE

    To steal ideas from one is plagiarism. To steal from many is Research.

    ADDRESS

    Mumbai , Maharashtra

    EMAIL

    shikha.pathak6@gmail.com
    shikha.the.swt.pari@gmail.com

    Skype

    shikha_pari