android-volley

get JSON data from web and display using RecyclerView

情到浓时终转凉″ 提交于 2019-12-11 15:03:16
问题 I'm new android, I was create app, it get json data from table in phpmyadmin then save in database of app. And I read data and display on RecyclerView but when I run app at first time, table database show nothing. But from the second time app can read data and display as I want. Anyone help me to run app in the first time as the second time please. Here is my code: db.querydata("Create table if not exists tbl_mon_app (_ID integer primary key, IDMon integer not null, IDCH integer not null,

org.json.JSONException: End of input at character 0 of, android

南笙酒味 提交于 2019-12-11 14:47:03
问题 I am implementing an android app and trying to make a register and login screens. my app is connected to a server, here is the part my code that makes error: public void onResponse(String response) { Log.d(TAG, "Register Response: " + response.toString()); hideDialog(); try { JSONObject jObj = new JSONObject(response); boolean error = jObj.getBoolean("error"); if (!error) { // User successfully stored in MySQL // Now store the user in sqlite String uid = jObj.getString("uid"); JSONObject user

Volley DiskBasedCache throws FileNotFoundException

拜拜、爱过 提交于 2019-12-11 14:25:49
问题 I'm using BitmapLRUCache by Trey Robinson for image caching in my Android app. It's an implementation of LRU cache for Volley as it doesn't provide any image caching by itself. Though it does use DiskBasedCache for caching HTTP requests. Now coming to the problem, I get FileNotFoundExceptions repeatedly when DiskBasedCache tries to get or remove cache entries. Sample log below. 23833 Volley D [47291] DiskBasedCache.remove: Could not delete cache entry for key=http://a2.mzstatic.com/us/r30

Cannot retrieve error message from server in Error Listener of Volley in Android

孤者浪人 提交于 2019-12-11 13:46:45
问题 I am developing an Android app. In my app, I am posting data to server via API using volley. But I am having a problem with retrieving error message from server and parsing it. From server I am returning json data with Http status code 400 like this: { "name":["name is required"], "email":["email is required"] } So when I make volley request to it, I am getting error with status code 400 as you can see in screenshot below. What I want is, I want to parse that error message from server and

com.android.volley.parse error org.json.jsonexception value of type java.lang.string cannot be converted to jsonArray in Android Volley

╄→尐↘猪︶ㄣ 提交于 2019-12-11 13:45:44
问题 When I run this program I get this error . I don't know how to solve . Help me finding it Please. This is my json_encode php code api. $i=0; while ($row = $result->fetch_assoc()) { $array[$i]=array( "news_id" => $row["news_id"], "news_title" => $row["news_title"], "news_abstract" => $row["news_abstract"], "news_content" => $row["news_content"], "news_date" => $row["news_date"], "news_link" => $row["news_link"], "news_image_link" => $row["news_image_link"], "sources_name" => $row["sources_name

do android volley have callback do something like java finally?

别来无恙 提交于 2019-12-11 13:25:13
问题 I have to do something after the request finish. like dismiss a loading dialog I have to add dialog.dismiss(); in every request for both onResponse() and onErrorResponse(). Do volley have global callback? I want to have global callback in same fragment/activity to handle error/successful message JsonRequest jsonRequest = new JsonRequest (url, params, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { dialog.dismiss(); } }, new Response.ErrorListener(

Volley and Gson -Sending a POST request using JSONObjectRequest

别说谁变了你拦得住时间么 提交于 2019-12-11 12:52:51
问题 I'm new here and I don't very well speak English, but I do my best to explain me. I have some problems with the Post request. This is my code: private void makeRequest() { String url = "http://diegocardenas.netau.net/comprobar_usuario.php"; JsonObjectRequest request1=new JsonObjectRequest(Method.POST, url, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { onConnectionFinished(); Usuario usuario = new Gson().fromJson(response.toString(), Usuario

How can send arraylist data from volley request and get in php

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 12:49:11
问题 I want to send a ID and array list of string data to php from volley requset . but i'm not sure how can send correctly to server and how can get it in php . Here is android side to send request to server: private void sendMessage() { StringRequest stringRequest = new StringRequest(Request.Method.POST, Config.NOTIF_URL, new Response.Listener < String > () { @Override public void onResponse(String response) { Log.d("Response --->", response); jsonNotif = new ParseJSON(response); jsonNotif

Volley, json and php connection

狂风中的少年 提交于 2019-12-11 12:34:02
问题 I'm trying to get data from a MySql db. This is the php code : <?php if($_SERVER["REQUEST_METHOD"]=="POST"){ include 'connection.php'; showStudent(); } function showStudent(){ global $connect; $query = " Select * FROM utenti"; $result = mysqli_query($connect, $query); $number_of_rows = mysqli_num_rows($result); $temp_array = array(); if($number_of_rows > 0) { while ($row = mysqli_fetch_assoc($result)) { $temp_array[] = $row; } } header('Content-Type: application/json'); echo json_encode(array

Insert populated listview items to database in android using php

只愿长相守 提交于 2019-12-11 11:45:04
问题 Here i am populating a listview from database using php file..after fetching from database i want to add those to another table..here in my onclick of add button toast message is displaying respective name..but when i try to add the name to database in uploadImage() method,only the last name present in the listview is inserted to database irrespective of the name. How to insert the respective name when it is clicked. here is the list.. here is my code.. package info.androidhive