java - Android Volley - Getting No Response using StringRequest to XML API -
i no response when request string xml api. here's code :
string url = "http://www.w3schools.com/xml/note.xml" string url2 = "http://api.json.request" requestqueue queue = volley.newrequestqueue(context); stringrequest stringrequest = new stringrequest(request.method.get, url, new response.listener<string>() { @override public void onresponse(string _response) { log.d("json=>",_response); res = _response; } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { // error handling log.d("jsone=>", error.tostring()); } }); queue.add(stringrequest);
i have tested using google api (url2), it's fine. maybe android volley run slow when try response, seeing log didnt @ all.
the log when initiate request :
01-28 10:57:05.253 21424-21424/com.merahjambutech.zuki.deteksi i/timeline: timeline: activity_launch_request time:26387334 01-28 10:57:05.353 21424-21424/com.merahjambutech.zuki.deteksi d/pre=: 0 01-28 10:57:05.433 21424-21424/com.merahjambutech.zuki.deteksi w/imageloader: try initialize imageloader had been initialized before. re-init imageloader new configuration call imageloader.destroy() @ first. 01-28 10:57:05.463 21424-21470/com.merahjambutech.zuki.deteksi d/dalvikvm: gc_for_alloc freed 503k, 11% free 24699k/27632k, paused 29ms, total 29ms 01-28 10:57:05.483 21424-21470/com.merahjambutech.zuki.deteksi i/dalvikvm-heap: grow heap (frag case) 29.898mb 3686416-byte allocation 01-28 10:57:05.543 21424-21424/com.merahjambutech.zuki.deteksi w/imageloader: try initialize imageloader had been initialized before. re-init imageloader new configuration call imageloader.destroy() @ first. 01-28 10:57:05.573 21424-21547/com.merahjambutech.zuki.deteksi d/dalvikvm: gc_for_alloc freed 173k, 10% free 28324k/31236k, paused 15ms, total 15ms 01-28 10:57:05.573 21424-21547/com.merahjambutech.zuki.deteksi i/dalvikvm-heap: grow heap (frag case) 33.438mb 3686416-byte allocation </note> 01-28 10:57:05.643 21424-21424/com.merahjambutech.zuki.deteksi i/timeline: timeline: activity_idle id: android.os.binderproxy@42485428 time:26387720
please ensure add permission in manifest
file:
<uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_network_state"/>
Comments
Post a Comment