Asynctask and doInBackground errors

前端 未结 2 381
旧巷少年郎
旧巷少年郎 2021-01-28 18:31

I have followed a number of guides and other questions I think exactly but I have an error that I can\'t fix.

Against this line

private class loadNotams         


        
相关标签:
2条回答
  • 2021-01-28 19:22

    Make it a variable argument method

    protected Void doInBackground(String... airfield)
    
    0 讨论(0)
  • 2021-01-28 19:38

    change

     protected Void doInBackground(String airfield)
    

    to

     protected Void doInBackground(String... airfield)
    

    or

     protected Void doInBackground(String[] airfield)
    

    as doInBackground() methods requires array of Strings as parameter

    and also change to

       try {
            doc = Jsoup
                    .connect(
                            "https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs")
                    .data("retrieveLocId", airfield[0])
                    .data("formatType", "ICAO")
                    .data("reportType", "REPORT")
                    .data("actionType", "notamRetrievalByICAOs")
                    // .userAgent("Mozilla")
                    // .cookie("auth", "token")
                    .timeout(3000).post();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    
    0 讨论(0)
提交回复
热议问题