Developing an Android application using eclipse. On user's info page, if I insert arabic text in fullname field (TextView
), it saves question mark; Then again save some arabic text in same field.. it saves correct text; Next time again question mark and then correct text.. so on.
So basically it saves correct text in every alternate attempt. I've confirmed this more than 100 times
The file encoding is UTF-8
Here is the code for the text box:
<EditText
android:id="@+id/client_name_setting"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/client_user_profile"
android:background="@drawable/edit_bg"
android:imeOptions="actionNext"
android:singleLine="true"
android:text="@string/name"
android:textSize="16dp" >
</EditText>
We are using volley to save details via webservice
public static void UpdateVendorWithoutFile(final String user_id,
final String category_id, String full_name,
final String email, String prefered_lang, final String email_alert,
final String contact_number, final String address,
ArrayList<String> location, final String national_id,
final String about, final String org_name, String nationality_id,String onlinestatus,
final Context context, final UpdateVendorCallback callmessage) {
String url = NetUtils.update_vendor;
JsonArray array = new Gson().toJsonTree(location).getAsJsonArray();
CustomJsonObjectRequest request = new CustomJsonObjectRequest(
Request.Method.POST, url, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject jsonObject) {
Log.v("TAG", "Success " + jsonObject.toString());
callmessage.UpdateVendorSuccess(jsonObject.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
if (volleyError instanceof TimeoutError
|| volleyError instanceof NoConnectionError) {
callmessage.UpdateVendorError(context
.getResources().getString(
R.string.connection_error));
} else if (volleyError instanceof AuthFailureError) {
callmessage.UpdateVendorError(context
.getResources().getString(
R.string.auth_error));
} else if (volleyError instanceof NetworkError) {
callmessage.UpdateVendorError(context
.getResources().getString(
R.string.net_error));
} else if (volleyError instanceof ServerError) {
callmessage.UpdateVendorError(context
.getResources().getString(
R.string.server_error));
} else if (volleyError instanceof ParseError) {
callmessage.UpdateVendorError(context
.getResources().getString(
R.string.parse_error));
}
}
});
request.setRetryPolicy(new DefaultRetryPolicy(
DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
HashMap<String, String> params = new HashMap<String, String>();
params.put("user_id", user_id);
params.put("category_id", category_id);
params.put("full_name", full_name);
params.put("email", email);
params.put("preffered_language", prefered_lang);
params.put("email_alert", email_alert);
params.put("contact_number", contact_number);
params.put("address", address);
params.put("location", array.toString());
params.put("national_id", national_id);
params.put("about", about);
params.put("org_name", org_name);
params.put("nationality_id", nationality_id);
params.put("online_status", onlinestatus);
params.put("lang", Locale.getDefault().getLanguage());
request.setParams(params);
RequestQueue queue = Volley.newRequestQueue(context);
queue.add(request);
}
I would really appreciate any help in this matter.
These are the questions which I referred before posting this question:
Text view displays Arabic characters as question marks "?????"