android-volley

How to make a Volley class a public method

给你一囗甜甜゛ 提交于 2019-12-12 06:38:48
问题 I have to call web service in multiple classes I am using Volley . so what should I do in onresponse method to trigger the other class for the response? I want to make syncData as a generic function for my all classes. public String syncData(Context mContext, String url) { try { RequestQueue queue = Volley.newRequestQueue(mContext); JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() { @Override public void onResponse

Can't send volley post request from android phone

淺唱寂寞╮ 提交于 2019-12-12 06:29:48
问题 I'm using Volley to send an http post request with parameters from my android app to my local server running in http://192.168.1.4:3000/battery_signal_report I'm pretty sure the server is running properly (I checked it with Postman successfully). also, I successfully sent the request through Android Studio's Emulator using ip 10.0.2.2 Trying to make it work, i used various request implementations including JsonObjectRequest, StringRequest and the custom request described here: Volley

sending volley request with nested hashmap parameters

痞子三分冷 提交于 2019-12-12 05:54:28
问题 i am using android volley framework for sending jsonobject request to my server.get request is working fine.now i would like to send a post request with request parameters which is nested hashmap< string,object >.i override the getparams method but it expects me to send hashmap< string,string >. there is any way to pass hashmap as request parameter? i have followed this link enter link description here 回答1: try override below method, it is from source code: /** * Returns the raw POST or PUT

Store Access Token in Android Local Storage?

我是研究僧i 提交于 2019-12-12 05:48:04
问题 I am not able to Store access-token,username in the SharedPreferences.How can this be Done? Login Class public class Login extends AppCompatActivity implements View.OnClickListener { EditText userName, Password; Button login; public static final String LOGIN_URL = "http://192.168.100.5:84/Token"; public static final String KEY_USERNAME = "UserName"; public static final String KEY_PASSWORD = "Password"; String username, password, accesstoken, tokentype; @Override protected void onCreate(Bundle

Accessing volley response with callback interfaces

一曲冷凌霜 提交于 2019-12-12 05:29:40
问题 I m trying to extract android volley response to a member variable of the same class. I used callback interfaces to perform this task : public void getData(MyCustomListener customListener) { JsonArrayRequest arrayRequest = new JsonArrayRequest(Request.Method.POST, url, response -> { Log.i("response",response.toString()); customListener.onResponse(completeCart); }, error -> Log.i("Volley_error", error.getMessage())) { ... CustomerListener interface: public interface MyCustomListener { public

Volley Server error this site requires java script enabled

夙愿已清 提交于 2019-12-12 05:28:28
问题 I am using volley to send web service request and volley response is SERVER ERROR (this site requires java script enabled). I tried POST and GET methods. After some search on this issue I found these two questions.. Volley Server error (Requires javascript?) Android Development but there is no answer to solve this issue in 2 months Disable Javascript on volley StringRequest but there is no answer to solve this issue in 6 months No more questions and solution found. Can anyone tell the exact

Android volley does not calling getParams in POST request

人盡茶涼 提交于 2019-12-12 05:28:14
问题 friends. I have a problem with my volley POST request with parameters. I need fetch the data from my remote MySQL DB and display it in recycler view. For this, I have using volley network request. Without parameters, it loads all the data from my DB. But when I add getParams() method it returns a null array even though corresponding DB entries are available according to the passing parameters. Here is my code.. public void setDonorsList(final VolleyCallBack volleyCallBack) { if (Utility

Android:Volley String Request with JsonObject Params

こ雲淡風輕ζ 提交于 2019-12-12 04:31:30
问题 I have run into an issue with Volley String/JsonObject requests. When I try to login, I want to pass json-data as parameters, but what I want to receive is a string. This causes issues because when using JsonObject request, it requires the data to be that of an JsonObject, and because the return type is of type java.lang.string it instead complains that it cannot convert type java.lang.string to jsonObject. Fine. When trying String request, the params can't be jsonObject, so that won't work..

Sent POST request but server says GET request in Android volley, what I am doing wrong here?

给你一囗甜甜゛ 提交于 2019-12-12 04:30:36
问题 Java dependencies { compile 'com.android.volley:volley:1.0.0' } Here it is a simple volley request by which I want to send some post data, but it looks like request goes as a GET request package xyz.hydroid.volleytest; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android

Error trying to POST specified “id” to server for json response with Android Volley

核能气质少年 提交于 2019-12-12 04:17:12
问题 I am carrying over a product id from the main activity to a detail activity then on to a comments activity. I am using Volley and Android Studio. I have a listview populated from a remote database. When an item is clicked, the items' id is passed to the detail activity using an intent. In the detail activity, when the user clicks on a FAB, that products id is passed over to the comments activity also using an intent. When I click on the FAB the comments activity opens but doesn't show