android-volley

Volley JsonObjectRequest send headers in GET Request

感情迁移 提交于 2019-12-23 12:37:33
问题 I am trying to send some authentication headers from GET request and I tried using Volley JsonObjectRequest call : Map<String,String> params=new HashMap<String,String>(); params.put("token","fghjbvjhnjjk"); activity.showDialog(); JsonObjectRequest req = new JsonObjectRequest(Request.Method.GET,url, new JSONObject(params), new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { Log.d(tag, response.toString()); activity.hideDialog(); try { activity

Android Volley POST Parameters

大兔子大兔子 提交于 2019-12-23 12:29:26
问题 I need to call an api that expects a string array as a POST parameter. So for an example of an API definition: POST api/names POST parameter expected is an array of names and some other attributes like below: { names: [ "John", "Bill" ], department: "Engineering" } I am currently using a custom Volley framework as described in the Android documentation but it seems like the parameters from Volley can only be passed as a Map of (String, String as key and value). I already have the array from

What is the most efficient way of updating UI in Volley

送分小仙女□ 提交于 2019-12-23 12:19:52
问题 lately I'm using Volley library in android.. It works fine but I was wondering about the most efficient way of updating the UI.. I have a Utils class that has all the Volley methods.. right now I pass all the Views that will be updated as parameters, but I've read that I could implement the listeners in my activity then pass them as parameters in the Utils class.. So my question is: Which is more efficient and why updating the UI like this: public void getSettings(final TextView exampleView)

How to send multipart request using Volley without HttpEntity?

牧云@^-^@ 提交于 2019-12-23 10:17:15
问题 I am following the solution to send multi-part request using volley from How to multipart data using Android Volley. But, since SDK 22, httpentity is deprecated and it's removed completely on SDK 23. The solution is to use openConnection, just like HttpEntity is deprecated on Android now, what's the alternative?, but I don't know how to use it for multi-part request 回答1: I have found a solution for this (based on Multipart/form-data requests in Android: HttpURLConnection vs OkHttp ) Here is

How to make a new newRequestQueue In Volley, Android

橙三吉。 提交于 2019-12-23 09:27:56
问题 I have an fragment where I try to Instantiate a new newRequestQueue with the Volley API. I try to instantiate it like this: RequestQueue queue = Volley.newRequestQueue(this); However, when I try to create the request, I get the following error: newRequestQueue In Volley cannot be applied to annonymous android.view.View.OnClickListener Here is my Fragment class: public class LoginFragment extends Fragment { private FacebookLogin fLogin; private Profile profile; private CallbackManager

com.android.volley.NoConnectionError after pausing app

╄→гoц情女王★ 提交于 2019-12-23 07:27:16
问题 I'm writing my app with Google Volley and Gson to talk to a REST service with OkHttp as HTTP-Stack. That works good most of the time but when I pause my app and return to it the HTTP requests don't work with this Exception: 09-08 19:29:19.611: E/ASDF(21827): com.android.volley.NoConnectionError: java.io.EOFException 09-08 19:29:19.611: E/ASDF(21827): at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:125) 09-08 19:29:19.611: E/ASDF(21827): at com.android.volley

send arraylist as parameter in volley request

喜欢而已 提交于 2019-12-23 05:26:00
问题 I'm trying to send arraylist containing numbers as parameter in volley request and then parse it and display the values (in string) in toast. But I'm getting null in response. I would like to know where is the problem. json response: { "got_members": [ "1", "2" ] } public class SearchFragment extends Fragment{ Button checkme; private static final String ADDMEM = "http://www.example.com/api/event/addmembers/", KEY_ADDMEM = "adding_members"; @Nullable @Override public View onCreateView

How to send a “multipart/form-data” POST in Android with Volley

戏子无情 提交于 2019-12-23 05:19:20
问题 Has anyone been able to accomplish sending a multipart/form-data POST in Android with Volley yet? I have had no success trying to upload an image/png using a POST request to our server and am curious if anyone has. I believe the default way to do this would be to override public byte[] getPostBody() in the Request.java class and attach the File there with a blank Header key for the boundary. However, converting my file to a String for the Map<String, String> postParams and then having it

Activity has leaked window while using volley

陌路散爱 提交于 2019-12-23 05:15:50
问题 I am using JSONRequest from volley library, in background as Asynctask() ... public class DataTask extends AsyncTask<String, Void, Void> { public static ProgressDialog pd; ... public DataTask(Context ctx,...) { ... pd = new ProgressDialog(context); ... } @Override protected void onPreExecute() { super.onPreExecute(); pd.setTitle("Please wait..."); pd.show(); } @Override protected Void doInBackground(String... params) { ... Log.d(TAG, " url=" + url); JSONRequest jsonObjReq = new JSONRequest

java.lang.NoSuchMethodError: No virtual method setTag(Ljava/lang/Object;)

落爺英雄遲暮 提交于 2019-12-23 03:15:09
问题 I just finish my codes for using log in and registration screen with volley but on running in emulator i get this error java.lang.NoSuchMethodError: No virtual method setTag(Ljava/lang/Object;)Lcom/android/volley/Request; in class Lcom/android/volley/Request; or its super classes (declaration of 'com.android.volley.Request' appears in /data/app/com.dreacot.street_crime-2/split_lib_dependencies_apk.apk:classes10.dex) according to the debug these are the files with issues please can anyone tell