androidで以下の(up_code.equals(v_code))の一文がどうしてもtureになってくれません。
Web側のPHPでechoをして特定の文字をレスポンスでandroidで取得しているのですがログキャットで見る限りup_codeと"1.0"は同じ値なのになぜかequalsで判定するとエラーの方に行ってしまいます。
ちなみにhttp通信が出来ている事と必ずif(up_code.equals(v_code))に通るのでどちらかの変数の型に問題があるのだと思います。
どなたかわかる方、ご教授をお願いします。
httpPost.setEntity(new UrlEncodedFormEntity(params2, "UTF-8")); HttpResponse httpResponse = httpClient.execute(httpPost); // ステータスコードを取得 int statusCode = httpResponse.getStatusLine().getStatusCode(); Log.e("statusCode", String.valueOf(statusCode)); // レスポンスを取得 HttpEntity entity = httpResponse.getEntity(); String response = EntityUtils.toString(entity, "UTF-8"); int index = response.indexOf(": "); index += ": ".length(); String up_code =response.substring(index); if (up_code.equals(”1.0”)) { Log.e("ture", up_code); } else { Log.e("エラー", up_code); showNotification(); } entity.consumeContent(); // クライアントを終了させる httpClient.getConnectionManager().shutdown();
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/12/03 06:07
2015/12/03 06:13
2015/12/03 07:08
2015/12/03 07:13
2015/12/03 07:26
2015/12/03 07:35
2015/12/03 07:42
2015/12/03 08:05 編集
2015/12/03 08:04
2015/12/03 08:08
2015/12/03 08:34
2015/12/03 08:39
2015/12/03 09:10
2015/12/03 09:18
2015/12/03 09:20