android-volley

Callback if Volley RequestQueue is done with all it's tasks?

浪尽此生 提交于 2020-01-01 06:30:42
问题 I am using the volley networking library for android. I'am looking for a way to get notified when a bunch of requests are finished, rather than checking all the response listeners individualy (which i also do). Is there an easy way to get a callback from the queue when all tasks are done? 回答1: Keep the requests count in a member variable and decrement everytime a request finishes, and when the counter goes to 0, you're done! I'm not aware of a callback exposed that tracks all the requests and

Android Volley Library doen't return whole response data

跟風遠走 提交于 2020-01-01 06:26:08
问题 Volley library doesn't return whole response data. It only return the part of the response data. I am calling drupal services. Below is my code for it. public void BoardRoomRequest() { pdialog = new ProgressDialog(BoardRoom.this); pdialog.setTitle("Please wait...."); String url = Global_Application.url + "views/boardroom"; Log.d("url========", url); Map<String, String> params = new HashMap<String, String>(); StringRequest req = new StringRequest(Request.Method.GET, getApplicationContext(),

out of memory issue with volley's disk cache

谁说胖子不能爱 提交于 2020-01-01 00:45:18
问题 In my app for Android I'm using Volley for loading images in custom listview. when i refresh(delete all items and load tiems) listview many times, my app is killed with this message how can i fix it? 04-26 13:08:01.038: E/dalvikvm-heap(18040): Out of memory on a 1684947261-byte allocation. 04-26 13:08:01.038: I/dalvikvm(18040): "Thread-11094" prio=5 tid=299 RUNNABLE 04-26 13:08:01.038: I/dalvikvm(18040): | group="main" sCount=0 dsCount=0 obj=0x439ea8e8 self=0x7fb55250 04-26 13:08:01.038: I

Should I worry about memory leaks and using WeakReference with Volley in Android

有些话、适合烂在心里 提交于 2019-12-31 10:48:11
问题 After reading this article, I started thinking about memory leaks with Volley. Usually, the listeners implemented with Volley have either an implicit or explicit reference to the outer class (the activity). for example: JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { updateLayout(); } } in this case there is an implicit reference... or I may want to create a custom

Volley or Service with cursor loader

只谈情不闲聊 提交于 2019-12-31 09:03:37
问题 I almost always use a Service when I download data from a web service. I store the result in a database and displays the result in my view using a cursor loader. But after Google released the network library Volley I have become a bit confused. The volley library uses async tasks instead of a Service and it doesn't use cursors. I thought that I was supposed to avoid async task and store my data in a database so that I could handle orientation changes properly - without loosing data and having

How to parse nested JSON using GSON

痞子三分冷 提交于 2019-12-31 05:13:04
问题 I am currently making a get request using volley and in onResponse i am trying to parse the jsonObject using gson to my model. JSON Returned after the request is made: { "success": 1, "message": "Done", "data": { "company": "companyname", "email": "email", "color": "#ffffff", "text_color": "#000000", "background_image": "BITMAP ENCODED", "logo": "BITMAP ENCODED", "enable_health_and_safety": 0, "health_and_safety": "", "sign_in_button_text": "SIGN IN", "sign_out_button_text": "SIGN OUT",

android volley posting binary body

早过忘川 提交于 2019-12-31 04:32:49
问题 Scenario - upload binary data in the body of a post, handle a response body containing JSON. How to do the following using Volley? curl -X POST -H "X-Application-Id: 3KxPB" -H "X-REST-API-Key: jkuI9" -H "Content-Type: audio/3gp" --data-binary '@test.3gp' https://host/1/files/audio IMO - there is a gap in Volley handling binary POST body types that apache httpclient handles in subclasses of abstracthttpentity. If buffered binary data generated on the phone by camera, microphone, or other

Android Volley ECONNRESET

社会主义新天地 提交于 2019-12-31 04:30:12
问题 I try to use Volley library and upload image to server. This library should do this process in standalone mode, but have got following error message: java.net.SocketException: sendto failed: ECONNRESET (Connection reset by peer) Is it maybe a server side misconfiguration? I try to upload a jpeg image with this code: private void uploadImage(){ final ProgressDialog loading = ProgressDialog.show(this,"Uploading...","Please wait...",false,false); StringRequest stringRequest = new StringRequest

How to handle “no internet connection” scenario when sending requests?

a 夏天 提交于 2019-12-30 11:11:17
问题 I'm currently developing an instant message application based on FCM (Firebase Cloud Message). My problem lies in the follow scenario: User is connected to an intermitent network - i.e. a wi-fi that, although holds the connection with the device, might lose internet connection from time to time with the internet provider; User attempts to send a message (a POST request using volley) when the device is connected to the wi-fi but with no internet connection; What is the best way to tackle this

How to handle “no internet connection” scenario when sending requests?

大兔子大兔子 提交于 2019-12-30 11:10:04
问题 I'm currently developing an instant message application based on FCM (Firebase Cloud Message). My problem lies in the follow scenario: User is connected to an intermitent network - i.e. a wi-fi that, although holds the connection with the device, might lose internet connection from time to time with the internet provider; User attempts to send a message (a POST request using volley) when the device is connected to the wi-fi but with no internet connection; What is the best way to tackle this