Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you click several times on the button you start several asyncTask, I suggest:</p> <ol> <li>Avoid multiple task: wait for previous execution end</li> <li>Use the following code to start the task:</li> </ol> <p>The code:</p> <pre><code>myTask = new GetDeviceLogTask(); if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) myTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null); else myTask.execute((Void[]) null); </code></pre> <p><strong>EDIT:</strong></p> <p>Ok I think you're doing to much things on the main thread that normally is used only to update the user interface and you may not use for caluclations. So try to move <code>Correccion()</code> and <code>.IsReachable1()</code> inside your async task:</p> <pre><code>class UpdateCandidatos extends AsyncTask&lt;String, String, String&gt; { protected String doInBackground(String... args) { if (!Titulacion.IsReachable1(getApplicationContext())) { return null; } Correccion(); List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("id", Nombres.getPID())); params.add(new BasicNameValuePair("test", nombre)); params.add(new BasicNameValuePair("pregunta", npregunta)); params.add(new BasicNameValuePair("bateria", levelstring)); params.add(new BasicNameValuePair("correctas", correctasString)); params.add(new BasicNameValuePair("errores", fallosString)); JSONObject json = jsonParser.makeHttpRequest(url_update, "POST", params); try { int success = json.getInt(TAG_SUCCESS); if (success == 1) { } else { } } catch (JSONException e) { e.printStackTrace(); } return null; } } </code></pre>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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