What is the way to send queries to Parse Server with Retrofit, rest api.
I found something like that:
trying to retrieve one object based on conditions values using Android REST API
But i don't understand how can I configure it for my kind queries in android:
#GET("classes/Mentor")
Call<OneMentorResponse> getMentor(#Query("where")
String where, #Header("X-Parse-Session-Token") String token);
pass a HashMap to query.
HashMap<String,String> sendKey=new HashMap<>;
sendKey.put("yourKey","yourValue");
yourApiInterface.getMentor(new JSONObject(sendKeyValue).toString()).new CallBack<OneMentorResponse response>{}
and implement the response and failure methods.
and also pass your header the way you are doing it.
I'm making an android application through Android Studio and I want to retrieve user details from a MYSQL database and display these details in different text views. So what are the possible ways to do the same?
I have attached my php code. I want to use the JSON array data and display it in text views.
<?php
$db_name="society_management";
$mysql_user="root";
$mysql_pass="";
$server_name="localhost";
$mail = $_POST['Email'];
$con=mysqli_connect($server_name,$mysql_user,$mysql_pass,$db_name);
$sql = "select * from member;";
$res = mysqli_query($con,$sql);
$result = array();
while($row = mysqli_fetch_array($res)){
array_push($result,aaray(
"mid"=>$row[0],
"nm"=>$row[1],
"hsno"=>$row[2],
"sts"=>$row[3],
"email"=>$row[4],
"mno"=>$row[5]
));
}
echo json_encode(array("result"=>$result));
mysql_close($con);
?>
You need to create web-service at server side that must return json response of Sql data you requires.
For calling that service from android code and display to textview can be easily achieved by Retrofit lib. That automatically parse json data to Java Model.
Need to use web services , Here is a good example http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/
Create a web-service at the server side which should return data in JSON format.
We can access data from the server by using either of the 3 ways in our android application :
Using Async task
Using Volly library
Using Retrofit
I am implementing the moethod to get json cel l content through google spreadsheet
The below is the part of my content
[{"scheme":"http://schemas.google.com/spreadsheets/2006","term":"http://schemas.google.com/spreadsheets/2006#list"}],"title":{"type":"text","$t":"traditional"},
"content":{"type":"text","$t":"ridicule: http://hkgalden.com/face/hkg/369.gif, adore: http://hkgalden.com/face/hkg/adore.gif, agree: http://hkgalden
.com/face/hkg/agree.gif, angel: http://hkgalden.com/face/hkg/a
ngel.gif, angry: http://hkgalden.com/face/hkg/angry
.gif, ass: http://hkgalden.com/face/hkg/ass.gif, banghead: http://hkgalden.com/face/hkg/
banghead.gif, biggrin: http://hkgalden.com/face/hkg/biggrin.gif
When it comes to using the following methods to extract link as follows
from
biggrin: http://hkgalden.com/face/hkg/biggrin.gif
to
http://hkgalden.com/face/hkg/biggrin.gif
Using
link = data[0].split(": ")[1];
It sometimes cannot get the values and hence insert the data record using ORMLite
and found empty data link
What should I follow afterwords?
Is using substring with lastOfIndex can help ?
Hi, I am new to android. I want to get data from webservice. in which key's are store in an array . and ley values stores in another array. In webservice data are display like,
{"1":{"para_id":"1","para_parent_id":"0","para_level":"0","para_type":"0","para_value":"Salution","para_desc":"Salution","para_sort_order":"1","para_tech_desc":"Salution","created_dt":"2011-08-11 19:47:05","created_by":"1","updated_dt":"2011-08-11 19:47:05","updated_by":"1","status":"A"},"1001":{"para_id":"1001","para_parent_id":"1","para_level":"0","para_type":"1","para_value":"Mr.","para_desc":"Mr.","para_sort_order":"1","para_tech_desc":"Mr.","created_dt":"2011-08-11 19:47:21","created_by":"1","updated_dt":"2011-08-11 19:47:21","updated_by":"1","status":"A"},"1002":{"para_id":"1002","para_parent_id":"1","para_level":"0","para_type":"1","para_value":"Ms.","para_desc":"Ms.","para_sort_order":"1","para_tech_desc":"Ms.","created_dt":"2011-08-11 19:49:00","created_by":"1","updated_dt":"2011-08-11 19:49:00","updated_by":"1","status":"A"},"1003":{"para_id":"1003","para_parent_id":"1","para_level":"0","para_type":"1","para_value":"Mrs.","para_desc":"Mrs.","para_sort_order":"1","para_tech_desc":"Mrs.","created_dt":"2011-08-12 09:40:14","created_by":"1","updated_dt":"2011-08-12 09:40:14","updated_by":"1","status":"A"},"2":{"para_id":"2","para_parent_id":"0","para_level":"0","para_type":"0","para_value":"Appointment Types","para_desc":"Appointment Types","para_sort_order":"1","para_tech_desc":"Appointment Types","created_dt":"2011-08-16 15:43:15","created_by":"1","updated_dt":"2011-08-16 15:43:15","updated_by":"1","status":"A"},"2001":{"para_id":"2001","para_parent_id":"2","para_level":"0","para_type":"2","para_value":"Scheduled","para_desc":"Scheduled","para_sort_order":"1","para_tech_desc":"Scheduled","created_dt":"2011-08-16 15:43:36","created_by":"1","updated_dt":"2011-08-16 15:43:36","updated_by":"1","status":"A"},"2002":{"para_id":"2002","para_parent_id":"2","para_level":"0","para_type":"2","para_value":"Cancelled","para_desc":"Cancelled","para_sort_order":"1","para_tech_desc":"Cancelled","created_dt":"2011-08-16 15:43:51","created_by":"1","updated_dt":"2011-08-16 15:43:51","updated_by":"1","status":"A"},"2003":{"para_id":"2003","para_parent_id":"2","para_level":"0","para_type":"2","para_value":"Re-Scheduled","para_desc":"Re-Scheduled","para_sort_order":"1","para_tech_desc":"Re-Scheduled","created_dt":"2011-08-16 15:44:24","created_by":"1","updated_dt":"2011-08-16 15:44:24","updated_by":"1","status":"A"},"2004":{"para_id":"2004","para_parent_id":"2","para_level":"0","para_type":"2","para_value":"Deleted","para_desc":"Deleted","para_sort_order":"1","para_tech_desc":"Deleted","created_dt":"2011-08-16 15:44:38","created_by":"1","updated_dt":"2011-08-16 15:44:38","updated_by":"1","status":"A"},"3":{"para_id":"3","para_parent_id":"0","para_level":"0","para_type":"0","para_value":"Customer Status","para_desc":"Customer Status","para_sort_order":"1","para_tech_desc":"Customer Status","created_dt":"2011-08-29 12:51:48","created_by":"1","updated_dt":"2011-08-29 12:51:48","updated_by":"1","status":"A"},"3001":
I want to sore key "1" ,"2", "3" in an array and related value in another array.and get the data. How can i do this?
Well, this looks like JSON, so use a JSON-Parser, for a tutorial see here. You can make your JSON more readable (especially when asking on SO) using the JSON beautifier
I am newbie in creating android app. I have created a database using xammp and a simple login layout using eclipse. Now I want to connect my login page and the database I created so that when the user enters his/her username and password it will then open the main menu of the application. I am hoping for someone who could help me on how to do this. Thanks in advance.
Try this code .....it will help u
data = openOrCreateDatabase(
"AutoProfiles.db"
, SQLiteDatabase.CREATE_IF_NECESSARY
, null
);
data.setVersion(1);
data.setLocale(Locale.getDefault());
data.setLockingEnabled(true);
final String CREATE_TABLE_LOCATIONS =
"CREATE TABLE IF NOT EXISTS tables ("
+ "name TEXT)";
data.execSQL(CREATE_TABLE_LOCATIONS);
YOur question is a bit confusing... Where does the database get into the Picture. Is the database used to store login information to determine which user is currently logged in?
If this is the case:
Retrieve login information, look through database for corresponding data.
Start new intent and different class with main menu layout.
Link the information in your database to your main menu
I am actually working on a similar project with my application. Here is a simple tutorial that has helped me alot with my project. It explains alot about how a database works in android using eclipse and how to set one up, add, remove, update and get data from that database then.
http://www.smashingmagazine.com/2011/03/28/get-started-developing-for-android-with-eclipse-reloaded/
Hope it helps you as much as it helped me
If you want to connect to a Mysql database you may need to use webservice such as PHP .
Here is how you do it :
You create a Mysql database
You create a PHP file which connects to database and does the data fetching and stuff
Using an AsyncTask use URL methods to acess the remote PHP file
Analyse the return result
The PHP file can either take GET or POST arguments
Example Snippet :
URL url = new URL("http://127.0.0.1/project/check_reg.php?uname="+email.getText().toString()+"&pwd="+password.getText().toString());
URLConnection urlcon = url.openConnection();
BufferedReader bf = new BufferedReader(new InputStreamReader(urlcon.getInputStream()));
String xresponse = bf.readLine();