android - Starting activity from static method -


i've problem starting activity's. i'm trying start new activity whithin static method.

this code that:

    static dialog dialog=null; public static void nextlevel(context c,string title,string message){        alertdialog.builder alertbox = new alertdialog.builder(c);      alertbox.settitle(title);      alertbox.setmessage(message);      alertbox.setpositivebutton("volgende level", new dialoginterface.onclicklistener() {          public void onclick(dialoginterface arg0, int arg1) {           }      });      alertbox.setnegativebutton("terug naar menu", new dialoginterface.onclicklistener() {          public void onclick(dialoginterface arg0, int arg1) {              startactivity(new intent(main.this, mainmenu.class));          }       });      alertbox.show(); } 

the startactivity doesn't work because can't start activity static method. can't seem figure out way solve problem because can't create context myself start it.

use

c.startactivity(new intent(c, mainmenu.class)); 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -