Android - 空指针execute()&DialogProgress AsyncTask

问题描述 投票:0回答:1

我在下面有这个代码,基本上是我的应用程序的登录过程,为什么我有空指针?我是否正确实现了它,我已经尝试使用静态AsyncTask来避免任何内存泄漏。

login.Java

    if (handler.executeLog(username.trim(), password.trim())) {
        session.saveLogin(username, password);
        Toast.makeText(this, "Successfully Logged In", Toast.LENGTH_SHORT).show();
        Intent log = new Intent(this, MainActivity.class);
        startActivity(log);
        handler.close();
        finish();
android-looper
1个回答
2
投票
 pd = new ProgressDialog(context);

contextnull

您应该在构造函数中初始化此值。

© www.soinside.com 2019 - 2024. All rights reserved.