Note that there are some explanatory texts on larger screens.

plurals
  1. POAsyncTask infinite loop
    primarykey
    data
    text
    <p>I am retrieving some data from a JSON API in the <code>doInBackground()</code> when my program is in <code>doInBackground()</code> method my Log indicates that the data is retrieved, but instead of going to <code>onPostExecute()</code> the <code>doInBackground()</code> is still running in an infinite loop. How can I stop that loop?</p> <p>This is my <code>doInBackground()</code> coding:</p> <pre><code>@Override protected String doInBackground(String... DATA) { // TODO Auto-generated method stub TYPE = DATA[0]; if(TYPE=="reservation_page") { URL = DATA[1]; jParser = new JsonParser(); json = jParser.getJSONfromUrl(URL+memberId); try { JSONArray reservation = json.getJSONArray(TAG_RSVTION); for(int i = 0; i&lt;reservation.length(); i++) { JSONObject r = reservation.getJSONObject(i); amount = r.getString(TAG_AMNT); gcpamount = r.getString(TAG_GCPAMNT); date1 = r.getString(TAG_DATE); month = r.getString(TAG_MNTH); year = r.getString(TAG_YEAR); time1 = r.getString(TAG_TIME); golfcourse_name = r.getString(TAG_GLFCRSNAME); no_of_player = r.getString(TAG_PLYRNO); HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put(TAG_AMNT, amount); map.put(TAG_GCPAMNT, gcpamount); map.put(TAG_DATE, date1); map.put(TAG_MNTH, month); map.put(TAG_YEAR, year); map.put(TAG_TIME, time1); map.put(TAG_GLFCRSNAME, golfcourse_name); map.put(TAG_PLYRNO, no_of_player); resvList.add(map); Log.v(TAG_LOG, "list: "+resvList); } Log.v(LoadingScreen.TAG_LOG, "reserv: "+reservation); Log.v(LoadingScreen.TAG_LOG, "name: "+golfcourse_name); } catch(JSONException e) { Log.v(LoadingScreen.TAG_LOG, String.valueOf(e)); } } return null; } </code></pre> <p>This is my <code>onPostExecute()</code> coding:</p> <pre><code>protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); if(TYPE=="reservation_page") { Intent in = new Intent(context, MyReservation.class); in.putExtra(TAG_MBRID, memberId); in.putExtra(TAG_AMNT, amount); in.putExtra(TAG_GCPAMNT, gcpamount); in.putExtra(TAG_DATE, date1); in.putExtra(TAG_DAY, day); in.putExtra(TAG_MNTH, month); in.putExtra(TAG_YEAR, year); in.putExtra(TAG_TIME, time1); in.putExtra(TAG_GLFCRSNAME, golfcourse_name); in.putExtra(TAG_PLYRNO, no_of_player); context.startActivity(in); } progress.dismiss(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload