0

「doInBackground()の実行中にエラーが発生しました」というエラーが表示されるため、ここで何が問題なのかわかりません。助けていただければ幸いです。私は非同期の初心者です。間違っている場合は説明してください。

private class childAsync extends AsyncTask<Void, Void, Void> {

    private final ProgressDialog dialog = new ProgressDialog(
            ChildClass.this);

    @Override
    protected void onPreExecute() {
        // TODO Auto-generated method stub
        super.onPreExecute();
        dialog.setMessage("Loading...");
        dialog.setIndeterminate(false);
        dialog.show();
    }

    ArrayList<HashMap<String, String>> touchpoints = new ArrayList<HashMap<String, String>>();

    @Override
    protected Void doInBackground(Void... params) {

        // Retrieve JSON Objects from the given string

        try {
            jsonObject = new JSONObject(JsonChildString); //testing data from JSON String 

            for (int i = 0; i < jsonArray.length(); i++) {
                HashMap<String, String> map = new HashMap<String, String>();
                jsonObject = jsonArray.getJSONObject(i);

                // Retrieve JSON Objects
                map.put(TEXT, jsonObject.getString("text"));
                map.put(ICON, jsonObject.getString("icon"));

                // set the JOSN Objects into the array
                touchpoints.add(map);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    protected void onPostExecute(Void result) {

        listview = (ListView) findViewById(R.id.list_child);

        // getting adapter by passing JSON data arrayList
        adapter = new LazyAdapterNew(ChildClass.this, touchpoints);

        listview.setAdapter(adapter);
        dialog.dismiss();
    }

}
4

1 に答える 1