如何在android中以hindi字体存储数据

时间:2016-05-10 09:45:23

标签: java php android mysql

我无法将我的Android应用程序中的印地文字符发送到服务器。

我尝试了几种方法,但后端的अगस्ता वेस्टलैंड का मामला आजकल输入结果为?????? ????????? ??

手动调用服务可以正常工作。

您可以在下面找到我的代码的相关部分,请查看并提出建议:

s1 = (Spinner)findViewById(R.id.spinner1);
s2 = (Spinner)findViewById(R.id.spinner2);
btn=(Button)findViewById(R.id.button_123);


protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_spinner_ex4);
    s1 = (Spinner)findViewById(R.id.spinner1);
    s2 = (Spinner)findViewById(R.id.spinner2);
    btn=(Button)findViewById(R.id.button_123);
    t=(TextView)findViewById(R.id.kuld);
    editText=(EditText)findViewById(R.id.edit_text);

    s1.setOnItemSelectedListener(this);

    btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Category = s1.getSelectedItem().toString();
            subcategory = s2.getSelectedItem().toString();
            comment = editText.getText().toString();
            foo1=Integer.toString(foo);

            new SendtoServer().execute();

            editText.setText(null);
            s1.setSelection(0);
            s2.setSelection(0);
        }
    });
}

SendtoServer:

class SendtoServer extends AsyncTask<String, Void, String> {
    ProgressDialog dlg;

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        dlg = new ProgressDialog(SpinnerEx4Activity.this);
        dlg.setMessage("Saving...");
        dlg.show();
    }

    @Override
    protected String doInBackground(String... params) {
        List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
        nameValuePairList.add(new BasicNameValuePair("CatId",comment));
        nameValuePairList.add(new BasicNameValuePair("subcategory", subcategory));
        nameValuePairList.add(new BasicNameValuePair("contents", comment));

        String result = new ServiceHandler().makeServiceCall("URL",2, nameValuePairList);
            Log.d("result =", result.toString());

        return result;
    }

    @Override
    protected void onPostExecute(String result) {
        super.onPostExecute(result);
        dlg.dismiss();
    }
}

1 个答案:

答案 0 :(得分:1)

您需要对ServiceHandler进行一些更改 写HTTP.UTF_8代替"utf-8"并告诉我。