在asynk任务中没有封闭的上下文

时间:2018-09-07 09:55:33

标签: error-handling progressdialog android-context

我上课

public class RequestHandler {
    ProgressDialog notif;
    // getting some data 
    …
    catch (Exception e) {
        e.printStackTrace();
        notif = ProgressDialog.show(secondactivity.this,"ERROR",e,false,false);  // <-- error in here
    }
}

// CALLED IN HERE (secondactivity.java)    
protected String doInBackground(Void... params) {
    RequestHandler rh = new RequestHandler();
    String s = rh.sendGetRequest(Konfigurasi.URL_GET_ALL);
    return s;
}

如何显示带有错误消息的对话框?

错误提示:

  

不在封闭类中

我应该添加上下文或其他内容吗?

顺便说一句:RequestHandler和secondactivity在不同的文件上。

0 个答案:

没有答案
相关问题