android-volley

Volley won't cache my requests

蓝咒 提交于 2019-12-12 03:04:11
问题 I am trying to cache data for offline usage without success. Below is my work so far. //fetch news details private void FetchHeadline(){ showDialog(); btnRefresh.setVisibility(View.GONE); // We first check for cached request Cache cache = AppController.getInstance().getRequestQueue().getCache(); Entry entry = cache.get(NEWS_URL); if (entry != null) { Log.e("", "babaaaaaaaaaaaaaaaaaaaaaaaa"); // fetch the data from cache try { String data = new String(entry.data, "UTF-8"); try { parseJsonFeed

Regarding loading items to the spinner using volley library

霸气de小男生 提交于 2019-12-12 03:00:56
问题 I am trying to load items to the spinner inside my MainActivity toolbar.Inside MainActivity there is a fragment called HomeFragment . And that fragment contains SlidingTabLayout and once I click different tabs I need to load different data sets to the above mentioned spinner. Here is how it looks like : I have implemented method inside MainActivity to add data to the spinner : public void addItemsToSpinner(final Collection<String> collection) { ArrayList<String> list = new ArrayList<>(); list

Send data to server with Volley Lib in Android

点点圈 提交于 2019-12-12 02:57:15
问题 I've developed a Application that i'm going to send data from the phone to the server by Json , to do this i use Volley Library in Android. but i can not send data to the server! my simple php code : $name = $_GET["name"]; $j = array('name' =>$name); echo json_encode($j); my java code : private void makeJsonObjectRequest() { mRequestQueue = Volley.newRequestQueue(this); String url = "http://my-site-name/sampleGET.php"; StringRequest jsonObjReq = new StringRequest(Request.Method.GET, url, new

How to handle Array of objects in response while using StringRequest in android volley

社会主义新天地 提交于 2019-12-12 02:14:24
问题 I have android app . in that app I'm posting some string data on server and get some response. Problem is ,I'm receiving the response in jsonstring,but I want this data in json array. althouugh when I'm using JsonArrayRequest ,it didn't allow post method in parameter and then my web service is not worked. So I'm stick with StringRequest and service works ok but complete response returns as a whole string.So I'm unable to display my data my list view . So how to resolve this issue? Here is my

Volley not sending correct data. How to implement an alternative to onPostExecute()?

我只是一个虾纸丫 提交于 2019-12-12 01:55:50
问题 I'm using Volley to get some JSON data to populate a RecyclerView list. The initial JSON file returns some information like: id server status If I request a new JSON using "Server URL/server/id" then I can get some extra information about the server/item to display on the view like: address type flavor I want to display in my RecyclerView list both sets of info for each item, like: server status address type flavor However I need the id of each server to get the extra info using a secondary

Execution failed for transformClassesWithJarMergingForDebug'. (Volley)

眉间皱痕 提交于 2019-12-12 01:37:02
问题 I am trying to build my app on android studio virtual simulator, I have successfully tested on api level 21 and above now I am testing lower level api 19, but whenever I run i will get this error: Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/android/volley/Request$Priority.class This is my gradle file: apply plugin: 'com.android.application' android {

Android VolleyBasicNetwork.logSlowRequests: HTTP response for request

主宰稳场 提交于 2019-12-12 01:29:28
问题 I have a problem with Volley GET request on slow network. Everytime I see BasicNetwork.logSlowRequests in my LogCat, my GET request is executed twice or more resulting multiple (2 or more) postings for 1 request. I already set the retry policy but It doesn't help. This is my LogCat 03-16 01:31:35.674: D/Volley(5984): [19807] BasicNetwork.logSlowRequests: HTTP response for request=<[ ] http://[myserver]/api/places 0xfa7d0c33 NORMAL 1> [lifetime=3824], [size=313], [rc=200], [retryCount=0] 03-16

Prevent Volley from sending cached parameters on POST request method when caching is implemented in volley

浪尽此生 提交于 2019-12-12 01:25:22
问题 I want volley to cache the response obtained from the server. Hence, I have implemented the caching code (ParseNetworkResponse). But volley is sending cached parameters when a POST request is made. How to prevent volley from doing this? Preferably how should the caching code below be modified to stop caching POST parameters? I want only the response from the server to be cached. public NetworkConnector(final Context ctx, String url, String methodType, final ArrayList<ArrayList<String>>

How to deal with unexpected response 500 in Android

送分小仙女□ 提交于 2019-12-12 01:17:47
问题 I am trying to retrieve a JSON from an external API using Volley. Here is my code protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test); final TextView mTextView = findViewById(R.id.testreq); RequestQueue queue = Volley.newRequestQueue(this); String url = "https://horoscope-free-api.herokuapp.com/?time=today&sign=cancer"; StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener

Android RecyclerView not updating items

荒凉一梦 提交于 2019-12-12 01:14:14
问题 I have a RecyclerView on my tabview fragment Activity. iam using arrayList to fill items on the recyclerview. Those JSON data are taken from this URL through volley library. Here is my code public class EditorsChoiceFragment extends Fragment { private RecyclerView mRecyclerView; private RecyclerView.Adapter mAdapter; private RecyclerView.LayoutManager mLayoutManager; private static String LOG_TAG = "EditorsChoiceFragment"; private String urlJsonArry = "http://checkthisphone.com/black.apps/get