Problems with Json receiving inner value

Asked

Viewed 48 times

0

I have this code which in turn what it does is to fetch an id from the database but the first value it will fetch is 0 past 1 second it will fetch the correct value tested with a output text .

Example First id it will fetch: 0

After 1 second gets id: 33

I 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 did not solve.

 JSONObject jsa = null;
    try {
        jsa = new JSONObject(myJSON);


        favId = jsa.getInt("FavoritoId");



    }
    catch (JSONException e) {
        e.printStackTrace();
    }

        dialog.dismiss();
  • Where do you keep this variable favId ? I believe you have to reset it

  • Wow, I almost didn’t understand anything! The problem is even in Json or the base from where that id is coming from?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.