Android connection Baidu Cloud database Demo

Source: Internet
Author: User

New Getpostask ("getgrouppos.php"). Execute ();//Start asynchronous class with PHP name in parentheses


public class Getpostask extends Asynctask<void, Void, list<info>> {//info is a custom class string Url;public Getpostask (String URL) {//get PHP filename this.url=url;} Protected list<info> doinbackground (Void ... params) {//Auto execute jsonobject jsonobject = null;//transfer parameters to php file list< basicnamevaluepair> list = new arraylist<basicnamevaluepair> (), List.add (New Basicnamevaluepair ("GroupID", GroupID)); try {jsonobject = mynetutil.sendgetrequest (constants.baseurl + url,//start list); if (jsonobject! = null) { Jsonarray Jsonarray = Jsonobject.getjsonarray ("Grouppos"),//json array to match the inside of the PHP file for (int i = 0; I <= jsonarray.length () ; i++) {Jsonobject JsonObject1 = (jsonobject) jsonarray.get (i); String Objecticon = jsonobject1.getstring ("Objecticon"); String ObjectID = jsonobject1.getstring ("ObjectID"); String objectName = jsonobject1.getstring ("ObjectName"); String objectaddress = jsonobject1.getstring ("objaddress"); String Objectcompany = jsonobject1.getstring ("Objectcompany");d ouble Infolat = jsonobject1.getdoUble ("Infolat");d ouble infolng = jsonobject1.getdouble ("infolng"), Info_all.add (new info (R.DRAWABLE.A01, R.drawable.maker,objectid, ObjectName, Objectaddress,objectcompany, Infolat, INFOLNG));}} catch (Exception e) {e.printstacktrace ();} return info_all;} @Overrideprotected void OnPostExecute (list<info> result) {//Then executes this part after execution of the above, result is the return value above Info_ Allsuper.onpostexecute (result);//write down what to do after getting the data from the Cloud Database}}


Android connection Baidu Cloud database Demo

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.