android - Trying to create a intent in the onPostExecute methed of a AsyncTask -


i'm using asynctask task load response web server. depending on response is, start new activity or display error message. right i'm trying within onpostexecute method of asynctask class. constructor undefined error when try create intent.

here code:

protected void onpostexecute(string result) {         // code thate xcicutes after thread       if ( result.contains("ok"))         {             presave();              intent i;              if (chatorgame==1)                = new intent(cglobals.mparent );             else                 = new intent(cglobals.mparent);              startactivity(i);                }         else         {             if (binterneterror==false)             {             new alertdialog.builder( cglobals.mparent)             .settitle("log in error")             .setmessage( "user name or password" )             .setneutralbutton("close",new dialoginterface.onclicklistener()             {                 public void onclick(dialoginterface dlg, int i)                 {                  }} ).show();                          }         }    } 

you need add activity want start intent

i = new intent(cglobals.mparent, nextactivity.class); 

intent doesn't have constructor accepts context error. need add activity start intent knows information. assuming of course cglobals.mparent context, believe way using elsewhere , name have given it. , meant intent i intent i think typo or shouldn't compile

note @trinimon said in comment, sure whatever activity starting intent defined in manifest or have further issues


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 -