我正在尝试使用齐射检查服务器数据库中的数字,因此我在Android Lollipop及更高版本中没有任何问题,我可以正确得到结果,但是当我使用KitKat版本时却没有任何结果。 我该如何解决?
实现'com.android.volley:volley:1.0.0'
public class ChknumModel implements ChknumPre {
ChknumView _view;
Context _context;
public ChknumModel(ChknumView view,Context context){this._view = view;this._context = context;}
@Override
public void checknumber(String number) {
RequestQueue queue = Volley.newRequestQueue(_context);
StringRequest request = new StringRequest(Request.Method.GET,
DirectionU.BASE_URL_USERS + "chknumber/" + number + "/",
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
if(response.equals("found_number"))
_view.found_number();
else
_view.not_found_number();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d("chknumber","error is " + error.getMessage());
}
});
request.setRetryPolicy(new DefaultRetryPolicy(
50000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
queue.add(request);
}
}