I have this code which in turn what it does is fetch an id from the database but the first value it fetches is 0 passed 1 second it fetches the correct value I tested with an output text.
Example First id it will fetch: 0
After 1 second, you have id: 33
Click again to get a close id or 34 it will fetch: 33
After 1 second I get id: 34
I used a dialog to try to solve the problem but it did not work.
JSONObject jsa = null;
try {
jsa = new JSONObject(myJSON);
favId = jsa.getInt("FavoritoId");
}
catch (JSONException e) {
e.printStackTrace();
}
dialog.dismiss();