android-volley

Android Volley synchronous request not working

廉价感情. 提交于 2019-12-10 22:45:27
问题 I am trying to make a synchronous request to the server using RequestFuture but it's not working . The same request when done using asynchronous works fine. This is my code: public void fetchModules(){ JSONObject response = null; RequestQueue requestQueue = Volley.newRequestQueue(getContext()); RequestFuture<JSONObject> future = RequestFuture.newFuture(); JsonObjectRequest request = new JsonObjectRequest(Url.ALL_MODULES_URL,null,future,future); requestQueue.add(request); try { response =

Volley.NoConnectionError : java.io.EOFException 0

橙三吉。 提交于 2019-12-10 21:27:56
问题 i don't understand this error , although i search many many time on th net, but nothing to do , the error appear sometime. I did an app which use VOlley library , and all work well, 95% of my request works, but sometime i have the error ; 11-12 12:18:54.991: I/Error(1870): com.android.volley.NoConnectionError: java.io.EOFException 0 and i don't know why this error appear. FOr example during y COnnection to the app , i send somes information like register_id for notification GCM , login,

Trying to send android volley post request to Laravel

青春壹個敷衍的年華 提交于 2019-12-10 19:09:15
问题 I am using laravel 5.1 for the database connectivity and sending the post request form android to laravel.. but the exception is showing "server error" Its my Android Code:- package com.example.ankit.postrequest; import android.app.DownloadManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.Toast; import com.android.volley

Unexpected response code 404 volley

天涯浪子 提交于 2019-12-10 18:48:28
问题 I am receiving an error for some requests sent by the following code, and I don't know why. private void DeActivateReq(String toolID, String token, String Childid) { String url = "http://54.77.126.165:8080/api/v1/nutrients/" + toolID + "/deactivate.json?token=" + token + "&member_id=" + Childid; StringRequest request = new StringRequest(Request.Method.GET, url, new Listener<String>() { @Override public void onResponse(String arg0) { // TODO Auto-generated method stub Log.e("response home",

Volley Image Loader ConcurrentModificationException

青春壹個敷衍的年華 提交于 2019-12-10 18:47:34
问题 I am using volley image loader for loading image on my project from server. But in some cases i am getting the following error and application crashes. java.util.ConcurrentModificationException at java.util.LinkedList$LinkIterator.next(LinkedList.java:124) at com.android.volley.toolbox.ImageLoader$4.run(ImageLoader.java:440) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app

UnsupportedOperationException while calling Volley request with headers

限于喜欢 提交于 2019-12-10 18:32:07
问题 I try to make call request with Volley library. I want to set headers, but I'm getting java.lang.UnsupportedOperationException. Do you know why , and how can I solve this problem ? public void getAccountInfo() { RequestQueue queue = Volley.newRequestQueue(getApplicationContext()); String url = "http://demo.gopos.pl/oauth/token"; StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() { @Override public void onResponse(String response) { //

POST string and response in JSONArray

故事扮演 提交于 2019-12-10 18:22:12
问题 Actually i follow many stackoverflow answers related my question but none of answer is working and i simply post a string and in return i want a json Array NOTE: when i run my Hard code script it's perfectly well but in the script the POST value shows null Here is my Android code: private void getData(){ Bundle extras=getIntent().getExtras(); final String id = extras.getString("value").toString().trim(); JSONObject obj =new JSONObject(); final ProgressDialog loading = ProgressDialog.show

How do I put generic type for Gson's TypeToken?

霸气de小男生 提交于 2019-12-10 18:17:18
问题 EDIT After experimenting for a while, I know my problem is. I can't put generic type inside TypeToken ( Type type = new TypeToken<CustomResponse<T>>(){}.getType(); ). When I change T into POJOA , I can run my app just fine to deserialize json into POJOA , but not into POJOB and POJOC . How do I put generic type into TypeToken? Or, is it possible to do something like this: if (T == POJOA) { Type type = new TypeToken<CustomResponse<POJOA>>(){}.getType(); } else if (T == POJOB) { Type type = new

Volley Bug: Repeating a request when verbose logging is enabled fails

有些话、适合烂在心里 提交于 2019-12-10 17:29:38
问题 When trying to repeat a request after it has completed the Volley library throws an IllegalStateException if you have debug enabled (log.tag.Volley VERBOSE) because VolleyLog.Marker is marked as finished. If you disable the debug everything is fine. I need to repeat a request because the api I am using has an api token and if a request returns a TOKEN_EXPIRED HTTP status code I need to refresh the token and repeat the exact same request. I don't want to construct the request again. Is there a

Volley AppController class object returning null

微笑、不失礼 提交于 2019-12-10 16:13:26
问题 I am making an app that makes a JsonObjectRequest and retrieves a JSON data from an URL using the Volley Networking Library for android. AppController.java public class AppController extends AppCompatActivity { public static final String TAG = AppController.class.getSimpleName(); private RequestQueue mRequestQueue; private static AppController mInstance; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mInstance = this; } public static