Internet check with volley
<p>I have a static method , which returs boolean value by cheking if internet available or not. I am able to catch "NoerrorConnection" but can't return boolean false to calling function. How to send boolean value from ErrorListener ?</p><pre><br /><code>public static boolean isConnectingToInternet()<br /> {<br /> JsonObjectRequest req = new JsonObjectRequest(Request.Method.GET, "www.google.co.in", new Response.Listener<JSONObject>() {<br /> @Override<br /> public void onResponse(JSONObject response) {<br /><br /><br /> }<br /> }, new Response.ErrorListener() {<br /> @Override<br /> public void onErrorResponse(VolleyError error) {<br /> if (error instanceof NoConnectionError) {<br /><br /><br /> }<br /> }<br /> });<br /> AppController.getInstance().addToRequestQueue(req);<br /> return false;<br /> }<br /></code><br /></pre><br /><h2>Click here view more answers <a href="%20http://stackoverflow.com/questions/34526022/internet-check-with-volley">http://ift.tt/1IDa5N6</a></h2>
Nhận xét
Đăng nhận xét