2017-07-10 15 views
-4

これは私のサーバーから取得したJSONデータです{"成功": "メッセージ": "ありがとうございました"}。このを成功から抽出します。私はどうすればこのようにしてください助けてください。 successフィールドは、あなたがこのようにそれを読むためにIntegerないJsonObject必要されJSONで特定の情報を取得する方法

@Override 
     protected void onPostExecute(String result) { 

      try { 
       JSONObject reader= new JSONObject(result); 
       JSONObject obj1 = reader.getJSONObject("success"); 
       String check = obj1.toString(); 


       if (check.equals("3")) { 

        Toast.makeText(SignUpActivity.this, "You are already registered with us", 
          Toast.LENGTH_LONG).show(); 

        emailText.setText(""); 

        Intent intent = new Intent(SignUpActivity.this,ReferalIdActivity.class); 
        startActivity(intent); 

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

使用reader.getInt( "成功"); –

答えて

0

reader.getInt("success");

関連する問題