httppostを使用してサーバーに接続しようとしていますが、何らかのエラーが原因でできません。私は一度メソッドを実行呼び出していますHttppostが機能しない - AndroidでJSONの代わりにhtml応答を取得する
: これは私のアンドロイドコードです。
https://s23.postimg.org/47dwhsxvf/Screenshot_2016_12_24_11_05_49_com_spellbee_admi.png
Plszヘルプ:私はこの出力を取得しています!
httppostを使用してサーバーに接続しようとしていますが、何らかのエラーが原因でできません。私は一度メソッドを実行呼び出していますHttppostが機能しない - AndroidでJSONの代わりにhtml応答を取得する
: これは私のアンドロイドコードです。
https://s23.postimg.org/47dwhsxvf/Screenshot_2016_12_24_11_05_49_com_spellbee_admi.png
Plszヘルプ:私はこの出力を取得しています!
final RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext()); 最終StringRequest stringRequest =新しいStringRequest(Request.Method.POST、Appconfig.Url、新しいResponse.Listener(){@Override 公共ボイドonResponse(文字列の応答){
//compile 'com.mcxiaoke.volley:library:1.0.19'
// <uses-permission android:name="android.permission.INTERNET"/>
try {
jsonObject = new JSONObject(response);
JSONArray jsonArray = jsonObject.getJSONArray("Bros");
for(int i=0; i<jsonArray.length(); i++) {
JSONObject jsonObject1 = jsonArray.getJSONObject(i);
String SONG_ID = jsonObject1.getString("SONG_ID");
String GroupID = jsonObject1.getString("SONG_NAME");
String SONG_PIC = jsonObject1.getString("SONG_PIC");
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(),error.toString(),Toast.LENGTH_LONG).show();
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> parms = new HashMap<>();
// parms.put("MessageID",Model.getMESSAGE_ID());
return parms;
}
};
requestQueue.add(stringRequest);
}
あなたは指定しなかったコードが何をしているのか.. –
あなたはエラーを述べていません – Aaron
また、サーバー側のコードを記述してください..問題がなければ、わかりません。 –
ここにPHPコード –