android-volley

how to get cookies from volley response

笑着哭i 提交于 2020-01-02 06:57:07
问题 I need to get the cookies from server response. For network calling i am using volley library. getRequest(String url, Response.Listener<JSONObject> responseListener, Response.ErrorListener errorListener) { try { JsonObjectRequest req = new JsonObjectRequest(Request.Method.GET, url, null, responseListener , errorListener) { @Override public Map<String, String> getHeaders() throws AuthFailureError { return getAuthHeader(context); } }; RetryPolicy policy = new DefaultRetryPolicy(socketTimeout,

Android volley, how to pass post parameters dynamically

半城伤御伤魂 提交于 2020-01-02 06:21:09
问题 I'm new to google's Volley network library (and also to Android !), and I'm trying to pass POST arguments in a dynamic way ! For now I am overiding the : getParams() method : And returning the params in an hard coded manner. @Override protected Map<String, String> getParams() { Map<String, String> params = new HashMap<String, String>(); params.put("login", "my_login"); params.put("password", "my_password"); return params; } I would like to pass variables instead of "hard coded" strings...

Send a DELETE Request using Volley (Android) to a REST Api with parameters?

谁说胖子不能爱 提交于 2020-01-02 05:36:11
问题 How do I send a DELETE Request using Volley (Android) to a REST Api with parameters like access_token and username. I have tried almost everything on Internet but still I am getting a 400 error Message. I have tried sending the same DELETE request using PostMan and it works perfectly fine. Here is the Error: E/Volley﹕ [1112] BasicNetwork.performRequest: Unexpected response code 400 for http://myserverip/messages/2 and Here is the Java code that I am using: String URI = "http://myserverip

Volley: MultipartRequest.getBody: IOException writing to ByteArrayOutputStream

允我心安 提交于 2020-01-02 04:47:08
问题 I am using Volley for my API call. I need to post a image to my sever. I have tried many MultipartRequest implementation, None works. I just tried using a sample from How to send a “multipart/form-data” POST in Android with Volley by AZ_. But I get MultipartRequest.getBody: IOException writing to ByteArrayOutputStream Error. Can you help me out on my code, or know any complete sample for uploading a image using Volley please. Thank you. import java.io.ByteArrayOutputStream; import java.io

Parsing json from url with Volley in a Fragment in Android

只谈情不闲聊 提交于 2020-01-01 19:57:06
问题 I want to parse json from the url below with Volley in one of my Fragment. The problem is that the "onResponse" does not activated. I tried to catch exception with Log and with Toast Notification. No any exception as well. It seems OnResponse doesnt fire in Fragment. This is my Fragment. public class PlacesToVisitFragment extends Fragment { public PlacesToVisitFragment() { // Required empty public constructor } StringBuilder sb = new StringBuilder(); @Override public View onCreateView

How Do We Set id For Data That Showed With Volley Json Array Request

房东的猫 提交于 2020-01-01 19:38:49
问题 I have some problem about setting and getting id from data that showed with volley JSon array request. I've tried to do this, but it fail. ChildTidur.java public class ChildTidur extends AppCompatActivity implements TidurAdapter.ContactsAdapterListener { private static final String TAG = ChildTidur.class.getSimpleName(); private RecyclerView recyclerView; private List<Story> storyList; private TidurAdapter mAdapter; private SearchView searchView; private TextView noFavtsTV; private

Wait for all requests in Android Volley

柔情痞子 提交于 2020-01-01 18:53:47
问题 I'm using Volley to connect to my REST API in my Android application and for some activities, I want to take some action only after all my requests have finished. In JavaScript, for those familiar with promises like in AngularJS, I would do: $q.all([ resourceA.get(), resourceB.get(), resourceC.get() ]) .then(function (responses) { // do something with my responses }) How can I do something like this with Volley? I know I could have the ResponseListener callbacks check against some integer

Fail with UTF-8 encoding in Volley Requests

*爱你&永不变心* 提交于 2020-01-01 18:17:27
问题 I made a project(BlogReader) using Volley library. If I encode json file in UTF-8 and reload my AndroidStudio Emulator the list view become white(white blank with menu header) . If I change json encode again on ANSI or win-1251 It starts to works. I changed Android File Encoding Settings on UTF-8, but nothing changed. How fix this problem? PS. Sorry, can't load screenshot, very low reputation( 回答1: To display the strings in UTF8 encoding Cyrillic, it helped me a lot: newStr = URLDecoder

Fail with UTF-8 encoding in Volley Requests

若如初见. 提交于 2020-01-01 18:17:17
问题 I made a project(BlogReader) using Volley library. If I encode json file in UTF-8 and reload my AndroidStudio Emulator the list view become white(white blank with menu header) . If I change json encode again on ANSI or win-1251 It starts to works. I changed Android File Encoding Settings on UTF-8, but nothing changed. How fix this problem? PS. Sorry, can't load screenshot, very low reputation( 回答1: To display the strings in UTF8 encoding Cyrillic, it helped me a lot: newStr = URLDecoder

java Android - volley library - get a Bitmap via ImageLoader

只愿长相守 提交于 2020-01-01 11:58:09
问题 I'm doing some examples with volley library for which there is so few docs/examples public class MainActivity extends Activity { private ImageView mImageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mImageView=(ImageView) findViewById(R.id.imageView1); RequestQueue queue = Volley.newRequestQueue(this); ImageLoader imageLoader = new ImageLoader(queue,new BitmapLruCache()); imageLoader.get("http:/