Skip to content Skip to sidebar Skip to footer

Asynctask And Doinbackground Errors

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 extends AsyncTask

Solution 1:

change

protectedVoid doInBackground(String airfield)

to

protectedVoid doInBackground(String... airfield)

or

protectedVoid 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();
    }

Solution 2:

Make it a variable argument method

protectedVoid doInBackground(String... airfield)

Post a Comment for "Asynctask And Doinbackground Errors"