android-volley

Volley does not call getParams for my custom request?

旧时模样 提交于 2019-12-18 02:54:05
问题 Please, does Volley automatically add my GET params to the URL? For me it's not working so and also when looking into sources, I just cant find any call of the getParams method.. So should I build the URL myself? It's no problem at all, I just thought that when there is such method like getParams, it could do that for me:) UPDATE: Below is my code.. public class BundleRequest extends com.android.volley.Request<Bundle>{ private String token; private OnAuthTokenValidatorResponseListener

Why does volley's response string use an encoding different from that in the response headers?

无人久伴 提交于 2019-12-18 02:10:08
问题 When doing a volley request (either StringRequest or JsonObjectRequest ), using the OkHttp stack, the response string's encoding is set to ISO-8995-1, which is the default encoding. The response has a header: content-type=text/html; charset=utf-8 , which should be detected. Why isn't it? 回答1: Both of those request types call HttpHeaderParser.parseCharset , which is able to determine the charset from the headers. However, it requires that the header be Content-Type , not content-type : it is

How to disable Volley request from retrying?

我怕爱的太早我们不能终老 提交于 2019-12-17 23:05:32
问题 I post a JsonRequest to a server. The server is slow. Volley tends to make multiple calls to the slow server because it didn't get a response from the first request (since my server is slow). Is there any way to disable Volley from retrying a request so that it can receive the first response? I have tried: myRequest.setRetryPolicy(new DefaultRetryPolicy( TIMEOUT_MS, RETRIES, BACKOFF_MULT)); I have replaced TIMEOUT_MS = 0, RETRIES = 0, and even BACKOFF_MULT = 0, but it doesn't work. Any other

Upload image via volley throwing error. Having array of image and array of text [duplicate]

吃可爱长大的小学妹 提交于 2019-12-17 19:52:19
问题 This question already has answers here : Getting NoSuchFieldError INSTANCE org/apache/http/message/BasicHeaderValueParser (6 answers) Closed 4 years ago . Solution Given below I am using volley library to upload image. Condition is I require to send key1 = String value key2 = String value key3{=file} = Image value i.e. jpeg, jpg This is the code I am using (commented portion is something I have already tried) - import com.android.volley.AuthFailureError; import com.android.volley

com.android.volly.AuthFailureError in making basic volly POST request to a django server

限于喜欢 提交于 2019-12-17 19:51:32
问题 I am trying to connect to a django server from my android application. I am trying to access my api, making a POST request with volly. Everything is set. All the params and headers required, but still I get this error. log: [490] BasicNetwork.performRequest: Unexpected response code 401 for https://example.com/ It's not letting me access my django Api. It works fine with the PHP server. public void vollyRequest() { RequestQueue queue = Volley.newRequestQueue(this); StringRequest request = new

Volley JSONArrayRequest with JSONObject as parameter

我们两清 提交于 2019-12-17 19:31:39
问题 I need to make a request with a JSONObject as follows: { 'LangIDs': [1, 2], 'GenreIDs': [4], 'LowPrice': 0, 'HighPrice': 999, 'SearchTerms': [], 'Pagination': { 'PageNumber': 0, 'PageLength': 10 } } The expected response is a JSONArray. Using Volley, I can't make a JsonArrayRequest with a JSONObject parameter. Before I made the request this way: StringRequest jsonObjectRequest = new StringRequest(Request.Method.POST, url, new Response.Listener < String > () { @Override public void onResponse

How to load data(json) into recycler view using volley

倾然丶 夕夏残阳落幕 提交于 2019-12-17 19:03:56
问题 I have implemented recyclerview in my application and now i need to fetch data from the server and i just came to know about volley being the best way to fetch data. I searched online but i am unable to find a proper tutorial for the same. This is how i initialized the recyclerview in my code.(which has hardcoded data set) mRecyclerView = (RecyclerView) findViewById(R.id.recyclerview); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); linearLayoutManager.setOrientation

Volley Image Caching

ぃ、小莉子 提交于 2019-12-17 18:54:12
问题 I am trying to understand Volley's image caching. I have a fragment with gridview inside it, which will load around 12-30 images. There images are retrieved from server and i am using NetworkImageView for loading these images. I am able to display the images in the NetworkImageView and everything works fine. But, when I change from one fragment to another and come back to the previous fragment, in LogCat , I see that Volley is trying to fetch the images again. I read Volley automatically

Volley Post JsonObjectRequest ignoring parameters while using getHeader and getParams

廉价感情. 提交于 2019-12-17 18:47:06
问题 I am trying to connect API url="api adress" which accepts two header types application/json to reponce in json and application/xml to reponce in xml. I need to hit JSON with json parameters and responce will be in json format too. Using android volley Post request with JsonObjectRequest setting headers using getHeaders it connects to server but getParams to set parameters does not work. RequestQueue queue = Volley.newRequestQueue(this); JsonObjectRequest jsonObjReq = new JsonObjectRequest

Volley - http request in blocking way

不想你离开。 提交于 2019-12-17 18:29:00
问题 I'm learning how to use Google Volley these days. It's very convenient for fast networking. It seems that all the requests are running in background in Volley. For example: volleyRequestQueue.add(new JsonObjectRequest(Method.POST, SIGNUP_URL, reqBody, new SignUpResponseListener(), new MyErrorListener())); Using the above code, we can make a POST call which runs in background(non-blocking way). Now my question is : Is it possible to make the POST call in the blocking way? Why I need a blocking