Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android正在跳过截击动作_Android_Android Volley - Fatal编程技术网

android正在跳过截击动作

android正在跳过截击动作,android,android-volley,Android,Android Volley,我的android应用程序在截击方面有问题 应用程序正在跳过截击动作,我得到的只是一个空变量 有没有办法等到截击动作完成后再继续 StringRequest stringRequest = new StringRequest(urlpop, new Response.Listener<String>() { @Override public void onResponse(String response) { try

我的android应用程序在截击方面有问题

应用程序正在跳过截击动作,我得到的只是一个空变量

有没有办法等到截击动作完成后再继续

    StringRequest stringRequest = new StringRequest(urlpop, new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {


            try {
                JSONObject jsonObject = new JSONObject(response);
                JSONArray jsonArray = jsonObject.getJSONArray("data");
                JSONObject jo = jsonArray.getJSONObject(0);


               appinter = jo.getString("inter");
                 appbanner = jo.getString("banner");
                 
                Log.d("EX DATA",appbanner);
                Log.d("EX DATA",appinter);


            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {


        }
    });

    RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext());
    requestQueue.add(stringRequest);
StringRequest-StringRequest=new-StringRequest(urlpop,new-Response.Listener()){
@凌驾
公共void onResponse(字符串响应){
试一试{
JSONObject JSONObject=新JSONObject(响应);
JSONArray JSONArray=jsonObject.getJSONArray(“数据”);
JSONObject jo=jsonArray.getJSONObject(0);
appinter=jo.getString(“inter”);
appbanner=jo.getString(“banner”);
Log.d(“EX数据”,appbanner);
Log.d(“EX数据”,appinter);
}捕获(JSONException e){
e、 printStackTrace();
}
}
},new Response.ErrorListener(){
@凌驾
公共无效onErrorResponse(截击错误){
}
});
RequestQueue RequestQueue=Volley.newRequestQueue(getApplicationContext());
添加(stringRequest);

我想您忘了在请求中添加请求方法
request.method.GET

使用下面的代码

StringRequest stringRequest = new StringRequest(Request.Method.GET,urlpop, 
       new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
                try {
                    JSONObject jsonObject = new JSONObject(response);
                    JSONArray jsonArray = jsonObject.getJSONArray("data");
                    JSONObject jo = jsonArray.getJSONObject(0);
                   appinter = jo.getString("inter");
                     appbanner = jo.getString("banner");

                    Log.d("EX DATA",appbanner);
                    Log.d("EX DATA",appinter);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
            }
        });
        RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext());
        requestQueue.add(stringRequest);
StringRequest-StringRequest=new-StringRequest(Request.Method.GET、urlpop、,
新的Response.Listener(){
@凌驾
公共void onResponse(字符串响应){
试一试{
JSONObject JSONObject=新JSONObject(响应);
JSONArray JSONArray=jsonObject.getJSONArray(“数据”);
JSONObject jo=jsonArray.getJSONObject(0);
appinter=jo.getString(“inter”);
appbanner=jo.getString(“banner”);
Log.d(“EX数据”,appbanner);
Log.d(“EX数据”,appinter);
}捕获(JSONException e){
e、 printStackTrace();
}
}
},new Response.ErrorListener(){
@凌驾
公共无效onErrorResponse(截击错误){
}
});
RequestQueue RequestQueue=Volley.newRequestQueue(getApplicationContext());
添加(stringRequest);

嘿,谢谢你的回答,但即使添加了,它仍然会跳过