Read about how to send data to server in android using json, The latest news, videos, and discussion topics about how to send data to server in android using json from alibabacloud.com
double quotes)
Logical value (TRUE or FALSE)
Array (in square brackets)
Object (in curly braces)
Null
Jsonobject data is stored in Key-value, separated by colons, and the outer curly braces represent an objectFirst, create a bean class that stores dataBelow we use the JSON data obtained from the server
In Android Application Development, common data exchange formats include XML and JSON. Each of these two methods has its own advantages. We can choose a suitable one in specific application development. Next let's take a look at josn data parsing:
The example is always the best tutorial. Let's take a look at the exampl
Objectivelike in the preface to talk about their current situation, perhaps a sympathetic classmate, more is left to their own a souvenir, a few months or years to come back to see when it will be very feeling. Today speak language, JSON this data format before I do the server side of the day contact, naïve to think that the world of
In Android development, the general app is to get server-side data to update the UI, from the server to obtain the data can be JSON, its data is smaller than XML, the analysis of the Ch
After creationServerSocketAfter the objectAcceptMethod returnSocketObject, the server can interact with the client.
SocketClass andServerSocketThe class has two methods to get the input and output streams:GetInputStreamAndGetOutputStream. ForSocketClass, useGetInputStreamMethodInputStreamIs to obtain data from the server, andGetOutputStreamMethodOutputStreamIs to
The most common use of Android and iOS applications for web interaction is the JSON data protocol, which is a brisk feature of the mobile platform, and is a gradual replacement for XML, with the following two popular JSON formats:
{"
code": "10000",
"message": "Login OK",
"result": {
"User": {
"id": 1,
"nam
This article illustrates the way Android reads data to MySQL via JSON. Share to everyone for your reference, specific as follows:
First, you define several methods for parsing JSON Parsejsonmulti, the code is as follows:
private void Parsejsonmulti (String strresult) {try {log.v ("strResult11", "strresult11=" +st
Android reads JSON format data 1. What is JSON?JSON, all known as JavaScript Object Notation, is intended to be a representation of JavaScript objects.
JSON is a lightweight text data
Sending data to the server has two kinds of get and post.
First, you want to replace the HTML code in the body with the
Please enter a name: Do not input data, how to submit data.
Get We simply include the following: function hellopressed () { Dojo.io.bind ({ URL: ' Respo Nse.txt ', Handler:helloca
This article mainly introduces how JQuery submits data to the server in JSON format. If you need it, you can refer to JQuery to encapsulate Ajax data requests so that this operation is much easier to implement. In the past, we had to write a lot of code to implement this function. Now we only need to call the $. ajax (
:
So far, the server project has been completed. Create an Android project.2. Create an Android client:
Android project structure:
Step 1: Create the business logic layer of the Android Project
Core code: SendDateToServer. java:
Package com. jph. sdg. service; import jav
The code is as follows
Copy Code
/*socket send and receive data@host (string) socket server IP@post (int) port@str (string) the data to send@back 1|0 socket end has data returnReturns true|false|
connection.
Include_once ("connect. php "); // connect to the database $ action =$ _ GET [action]; $ id = intval ($ _ GET [id]); if ($ action = "getlink") {$ query = mysql_query ("select * from user where id = $ id"); $ row = mysql_fetch_array ($ query ); $ list = array ("name" => $ row [username], "sex" => $ row [sex], "tel" => $ row [tel], "email" => $ row [email]); echo json_encode ($ list );}
This article shows how to use $. getJSON to send a
This article address:http://www.cnblogs.com/wuyudong/p/5900384.html, reprint please indicate source address. Transfer of dataClient: Send HTTP request http://www.oxx.com/index.jsp?key=valueServer: After receiving the request, send data to the client, (json,xml), JSON
void submitinfo (string name, string passwd, string mail) {// todo auto-generated method stubst Ring registerpath = "http: // 193.168.1.122: 8080/jsondemo/servlet/registerservlet? Type = register name = "+ name +" passwd = "+ passwd +" mail = "+ mail; system. out. println (registerpath); New downloadutil (registerpath, mhandler ). start ();}}
Note:I didn't return the specific data in JSON format here,
want to pass two parameters, continue adding a second parameter jsonparams.put ("Param2name", "Param2value") Jsonparams.put ("BD", "27"); httpentity bodyentity =neW stringentity (Jsonparams.tostring (), "UTF8");//The parameter must also be a string in JSON data format to be passed to the server side, otherwise "{' Message ': ' strUserName is invalid
Android getting JSON parsing from the server is displayed on the clientBaidu Experience: jingyan.baidu.comFirst of all, the most basic characteristics of JSON data, JSON data is a serie
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.