I am unable to call an activity from async task, i have tried different ways but every time i get a null pointer exception in the log cat.
I have tried this.
@Override
protected void onPostExecute(String result) {
if(signedin==false)
{
Toast.makeText(XMPPClient.context, "authentication failed:", Toast.LENGTH_LONG).show();
}
Intent i = new Intent(getApplicationContext(), ProfileHome.class);
startActivity(i);
}
and this
@Override
protected void onPostExecute(String result) {
XMPPClient xmpp = new XMPPClient();
if(signedin==false)
{
Toast.makeText(XMPPClient.context, "authentication failed:", Toast.LENGTH_LONG).show();
}else
xmpp.startnewactivity();
}
And in XMPPClient.class
public void startnewactivity()
{
Intent i = new Intent(getApplicationContext(), ProfileHome.class);
startActivity(i);
}
How can i call an activity from async task, actually I want to call activity when async task finishes.