When I am making a network call using jsonObject request. I am not receiving any response. I always receive HTTP response for request=<[ ] before my URL. I have tried these l
Try this using String Request
public class TestActivity extends AppCompatActivity {
RequestQueue requestQueue;
String DATA_URL = "http://ec2-54-147-238-136.compute-1.amazonaws.com/hmc/api/getnewsfeeds?order=asc";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
requestQueue = Volley.newRequestQueue(this);
callApi();
}
private void callApi() {
StringRequest stringRequest = new StringRequest(Request.Method.GET, DATA_URL, new Response.Listener() {
@Override
public void onResponse(String response) {
Log.e("res", response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("onErrorResponse: ", error.getLocalizedMessage());
}
});
requestQueue.add(stringRequest);
}