android-volley

Multipart file progress updating faster than actual upload

£可爱£侵袭症+ 提交于 2021-01-28 19:43:10
问题 I am trying to send a file to server using Multipart. This is how I am sending the request MultipartRequest request = new MultipartRequest(putURLPath, hashMap, null, new Response.Listener<String>() { @Override public void onResponse(String response) { try { Log.d(TAG, "FILE_UPLOAD_RESPONSE: " + response); Logger.writeToFile(TAG, "FILE_UPLOAD_RESPONSE: " + response); if (fileUploadListener != null) fileUploadListener.onAttachmentFileUpload(generateImageUploadResponse(false, getURLPath),

Problem with display MySQL data on android studio using volley

江枫思渺然 提交于 2021-01-28 11:29:27
问题 I am learning and trying to display some MySQL data using php to android studio using volley. The app is running with no errors but the data is not being displayed. I have tried to figure out why but had no luck for a few days (possibly due to I am still new to android studio and Java). My .sql is: SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@

MVVM architecture in android Using Volley

我们两清 提交于 2021-01-27 19:50:18
问题 I'm studying the MVVM to see if it can help me for my upcoming projects. What I understand so far, is that I need to use a ViewModel for holding my UI datas. I also need to use a Repository class to perform all my Requests to WebServices, and I'm using the Volley Library. So here's what I did : The ViewModel public class MyViewModel extends ViewModel { private MyRepository repository; private MutableLiveData<MyPojo> pojo; public MyViewModel(MyRepository repository) { this.repository =

Proper way to build a Volley Singleton

别来无恙 提交于 2021-01-25 03:33:58
问题 Edit: "Duplicate question" does not provide an applicable answer to this question. The approach provided there does NOT get rid of both warnings, only of one. Also my question contains a 2nd part which is not answered there either. If I build a Volley Singleton according to the official tutorial, https://developer.android.com/training/volley/requestqueue.html#singleton I get a warning for private static VolleySingleton mInstance and private static Context mContext saying "do not place android

Proper way to build a Volley Singleton

。_饼干妹妹 提交于 2021-01-25 03:32:32
问题 Edit: "Duplicate question" does not provide an applicable answer to this question. The approach provided there does NOT get rid of both warnings, only of one. Also my question contains a 2nd part which is not answered there either. If I build a Volley Singleton according to the official tutorial, https://developer.android.com/training/volley/requestqueue.html#singleton I get a warning for private static VolleySingleton mInstance and private static Context mContext saying "do not place android

PUT Request for Json with Json array inside

回眸只為那壹抹淺笑 提交于 2021-01-07 02:39:45
问题 I'm trying to update a PUT request which has a JSONArray inside it and I'm constantly getting a 500 error response. Here how the api structure is: { "imei": 514515854152463, "franquia": "SAO", "sistema": "PEGASUS", "lista": 2055313, "entregas":[ { "codHawb": "02305767706", "dataHoraBaixa": "2020-12-03T15:26:22", "foraAlvo": 1000, "latitude": 44.4545, "longitude": 45.545, "nivelBateria": 98, "tipoBaixa": "ENTREGA" } ] } I've tried the api in Postman to see if its working and it is. But when I

How to add custom header in volley request with kotlin

拜拜、爱过 提交于 2021-01-01 08:14:52
问题 I have a code Volley Code val queue = Volley.newRequestQueue(context) val stringRequest = StringRequest(Request.Method.GET, linkTrang, Response.Listener<String> { response -> mTextView.text = "Response is: " + response.substring(0,500)); }, Response.ErrorListener { }) { } queue.add(stringRequest) How do I set a header called Authorization in this?? 回答1: I was able to do it in Kotlin using: val linkTrang = "YOUR URL" val queue = Volley.newRequestQueue(this) val stringRequest = object:

How to add custom header in volley request with kotlin

怎甘沉沦 提交于 2021-01-01 08:01:12
问题 I have a code Volley Code val queue = Volley.newRequestQueue(context) val stringRequest = StringRequest(Request.Method.GET, linkTrang, Response.Listener<String> { response -> mTextView.text = "Response is: " + response.substring(0,500)); }, Response.ErrorListener { }) { } queue.add(stringRequest) How do I set a header called Authorization in this?? 回答1: I was able to do it in Kotlin using: val linkTrang = "YOUR URL" val queue = Volley.newRequestQueue(this) val stringRequest = object:

How convert a String response to an iterable object

☆樱花仙子☆ 提交于 2020-12-21 02:04:47
问题 I am trying to call a rest end point using Volley (HTTP library) in Android/Java app. Here is my code, RequestQueue queue = Volley.newRequestQueue(this); String url ="https://covid19datasl.herokuapp.com/countries"; StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() { @Override public void onResponse(String response) { System.out.println(response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error)