android-volley

Android Volley JsonObjectRequest not send params

半城伤御伤魂 提交于 2019-12-11 11:33:13
问题 I'm trying to send a JsonObjectRequest to my server with some params, but seems like params doesn't arrive at the server. Before to post on SO I try all kind of suggestion found in google but no one works fine.. This is the code of my JsonObjectRequest: RequestQueue queue = MySingleVolley.getInstance(ctx). getRequestQueue(); JsonObjectRequest jsObjRequest = new JsonObjectRequest(method,url,null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { Log

Cannot update ListView adapter in the Volley request listener in Android

此生再无相见时 提交于 2019-12-11 10:43:36
问题 I am new to Android. Now I start developing a project. In my project I am working list view with Volley network library. And I cannot update the adapter and list view is showing nothing. This is my Fragment with listview and Volley request: public class PodcastListFragment extends Fragment { private View view; private SwipeRefreshLayout refreshLayout; private ListView listView; private int channelId; private ArrayAdapter adapter; @Nullable @Override public View onCreateView(LayoutInflater

How I can use Realm to parse a large JSON and storing data

ε祈祈猫儿з 提交于 2019-12-11 10:42:20
问题 J'm really blocked into parsing and storing data using Realm,I have a large JSON and I creat all the class models like the example of RealM. this is my error :Caused by: org.json.JSONExcept ion: Value fr at 0 of io.realm.exceptions.RealmException: Could not map Json at io.realm.Realm.createObjectFromJson(Realm.java:860) at com.example.volleyapp2.ImagesActivity$ImagesFragment.loadData(ImagesActivity.java:179) at com.example.volleyapp2.ImagesActivity$ImagesFragment$2.onResponse(ImagesActivity

Parsing JSON using GET method with Volley in Android Studio

可紊 提交于 2019-12-11 10:17:50
问题 I got this json array : { "conferences": [ { "id": 1, "name": "Conferencia Magistral", "description": "Conferencia bien chingona lalala", "speaker": "Jorge", "biography": "bioo", "place": { "name": "Auditorio", "description": "Presentacion de peliculas y documentales" }, "date": "31/10/2015", "time": "16:00" } ] } And this is my code in Android Studio : queue = Volley.newRequestQueue(this); JsonArrayRequest JsonRequest = new JsonArrayRequest(Request.Method.GET, url, new Response.Listener

Array as Volley POST request params

穿精又带淫゛_ 提交于 2019-12-11 09:29:21
问题 I am trying to make a volley POST request with a array as my parameter, for example I want to POST {"types":[1,2,3]} what I have now is a string {"types":"[1,2,3]"} This is how I made my volley request: JSONArray jsonArray = new JSONArray(); JSONObject jsonObject = new JSONObject(); try{ jsonObject.put("types", list); jsonArray.put(jsonObject); System.out.println(jsonObject); }catch(Exception e){ } JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url,

Error org.json.JSONException: Index 2 out of range

筅森魡賤 提交于 2019-12-11 08:13:57
问题 Hello My simple Json is and i have error org.json.JSONException: Index 2 out of range can you help me to solve this problem ? : [ { "cat_id": 593, "title": "آلرژی و ایمونولوژی", "sub_cat": [ { "cat_id": 594, "cat_title": "متخصص", "cat_parent_fk": 593 }, { "cat_id": 595, "cat_title": "فوق تخصص", "cat_parent_fk": 593 } ] and get this json with this code but i have some error and just show two item of my json >15 item : JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.GET,

Unable to display data from remote server using MVVM architecture in android

末鹿安然 提交于 2019-12-11 07:56:17
问题 I am not able to parse json data from remote server. I am using MVVM architecture and volley library to parse json data. I tried to debug and the message says "An attempt to invoke virtual method has been made on a null object reference". I thought that the problem is due to LiveData class, so i removed it. Then, also it's not working. Please, also tell how to use LiveData class. BikesRepository.java package com.example.osama.dashbike.Repository; import android.content.Context; import com

How to fix 'Value name of type java.lang.String cannot be converted to JSONObject'

谁说我不能喝 提交于 2019-12-11 07:48:53
问题 I'm am using Volley to send an HTTP request in Android and I'm getting this error: java.lang.String cannot be converted to JSONObject. On the server side, I use a PHP script to get values from the database. My Android code: String server_url = "http://192.168.225.40/server/greetings.php"; JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, server_url,null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { name

ANDROID - send List to PHP via VOLLEY

三世轮回 提交于 2019-12-11 07:35:10
问题 Hello I have a List named StudentBATCH_LIST that I populated with the contents from a csv using: File csvFILE = new File(getFILE_PATH()); try { CSVReader csvREAD = new CSVReader(new FileReader(csvFILE.getAbsolutePath())); String[] csvLINE; int skip = 0; while((csvLINE = csvREAD.readNext())!=null) { if(skip > 0)//becasue first line is column headers { String PARAM_USER_ID = csvLINE[0]; String PARAM_STUD_FIRSTNAME = csvLINE[1]; String PARAM_STUD_LASTNAME = csvLINE[2]; String PARAM_STUD

CountDownLatch in Android locking thread

我是研究僧i 提交于 2019-12-11 06:36:16
问题 I've just started playing around with CountDownLatch in my Android app. Currently I am trying to make two Volley requests to my api, and wait until the data has been retrieved and stored before continuing with thread execution. This is a sample of my code: // new CountDownLatch for 2 requests final CountDownLatch allDoneSignal = new CountDownLatch(2); transactions.getResourcesForRealm(Contact.class, "", new ICallBack<Contact>() { @Override public void onSuccess(ArrayList<Contact> resources,