小编cle*_*ake的帖子

Android Volley - BasicNetwork.performRequest:意外的响应代码400

问题陈述:

我试图访问一个REST API,它将使用Volley返回各种HTTP状态代码(400,403,200等)的JSON对象.

对于200以外的任何HTTP状态,似乎"意外响应代码400"是一个问题.有没有人有办法绕过这个'错误'?

码:

protected void getLogin() {   
    final String mURL = "https://somesite.com/api/login";

    EditText username = (EditText) findViewById(R.id.username);
    EditText password = (EditText) findViewById(R.id.password);

    // Post params to be sent to the server
    HashMap<String, String> params = new HashMap<String, String>();
    params.put("username", username.getText().toString());
    params.put("password", password.getText().toString());

    JsonObjectRequest req = new JsonObjectRequest(mURL, new JSONObject(
            params), new Response.Listener<JSONObject>() {
        @Override
        public void onResponse(JSONObject response) {

            try {
                JSONObject obj = response
                        .getJSONObject("some_json_obj");

                Log.w("myApp",
                        "status code..." + obj.getString("name"));

                // VolleyLog.v("Response:%n %s", response.toString(4));

            } catch (JSONException …
Run Code Online (Sandbox Code Playgroud)

android android-volley

22
推荐指数
4
解决办法
9万
查看次数

是什么导致消息"启用缅甸Zawgyi转换器"

我是Android新手,目前正在运行一些示例应用.从logcat,我注意到消息"10-01 20:14:26.536:D/TextLayoutCache(15027):启用myanmar Zawgyi转换器 "并想知道是什么原因造成的.

这是某种错误吗?

android southeast-asian-languages

9
推荐指数
1
解决办法
2124
查看次数