I've been having some issues with starting a new activity once an AsyncTask has completed. I've read that I can put code like this:
protected void onPostExecute(String result) {
super.onPostExecute(result);
if (progress.isShowing()) {
if (result.equals("true")) {
progress.dismiss();
activity.startActivity(new Intent(activity, Main.class));
}
}
}
But basically that just crashes and it's always on the line which it's starting the Activity, It comes up with the error NullPointerException but I can't figure out why?
Any idea?
Thanks Chris
检查以确保activity
不为null
,因为它可能是NullPointerException
的原因。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.