ورود

View Full Version : مشکل با کتابخانه volley



perkas
پنج شنبه 13 آبان 1395, 09:49 صبح
سلام

با کتابخانه VOLLEY دو مقدار رو به سرور ارسال میکنم . حالا اگر این 2 مقدار انگلیسی باشن انجام میشه ولی فارسی ارور میده

چه تغییراتی تو کد بدم که درست بشه ؟؟؟


RequestQueue MyRequestQueue = Volley.newRequestQueue(Send_Data.this);


String url ="http://xxxxxxxxxxxxxxx/sample.php";

StringRequest MyStringRequest = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
//This code is executed if the server responds, whether or not the response contains data.
//The String 'response' contains the server's response.
Log.i("VOLLEY", response);


}
}, new Response.ErrorListener() { //Create an error listener to handle errors appropriately.
@Override
public void onErrorResponse(VolleyError error) {
//This code is executed if there is an error.
//
Log.i("VOLLEY", error.toString());


}
}) {
protected Map<String, String> getParams() {
Map<String, String> MyData = new HashMap<String, String>();
MyData.put("NAME","xxxxx"); //Add the data you'd like to send to the server.
MyData.put("FNAME","test"); //Add the data you'd like to send to the server.
return MyData;
}
};

MyRequestQueue.add(MyStringRequest);

JYasProgramer
پنج شنبه 13 آبان 1395, 18:50 عصر
سلام
ارور فورس کلوزه؟؟

perkas
پنج شنبه 13 آبان 1395, 22:02 عصر
سلام
ارور فورس کلوزه؟؟

نه . چیزی ارسال نمیکنه . و تو لاگی که میگیرم ازش ارور میده

JYasProgramer
جمعه 14 آبان 1395, 08:42 صبح
خطای سمت سروره
کدای API مربوطه رو درست ننوشتی
یعنی بخش فارسی شو فعال نکردی
CHARACTER SET رو به utf8 ست کن.