Volley JsonObjectRequest response

前端 未结 3 1514
情书的邮戳
情书的邮戳 2021-01-25 14:04

I\'m retrieving data from my server through JSON using Volley JSONObjectRequest to achieve this. After getting the JSON response, I want to save it int

3条回答
  •  囚心锁ツ
    2021-01-25 14:42

    You should declare status as int instead of String.

    private int status=0;
    

    You can try this way

                    status = response.getInt("status");
                    description = response.getString("description");
                    if (status == 1) { 
                     checkingStatus(status);
                    } else {
                     checkingStatus(status);
                    }
    

    Then

    public void checkingStatus(int status){
            if(status == 1){
                // do your code
            }else{
                // do your code
            }
        }
    

提交回复
热议问题