Android 讀取後台資料並顯示。類比小區車輛管理系統

來源:互聯網
上載者:User

標籤:

幫別人做的示範系統,只具有基本的增刪查改功能。

核心是android端和後台通過http傳輸資料

後台是asp.net,資料庫是ms sql 2008

android端

private void getData() {RequestParams params = new RequestParams();params.put("action", "getlista");params.put("chepai", etSearch.getText().toString());netClient.post(Constants.che_URL, params, new BaseJsonRes() {@Overridepublic void onMySuccess(String data) {listdata.clear();if (!TextUtils.isEmpty(data)) {List<CheModel> models = (JSON.parseArray(data,CheModel.class));for (int i = 0; i < models.size(); i++) {Map<String, String> che = new HashMap<String, String>();che.put("name", models.get(i).getChepai());che.put("info", models.get(i).getXinghao());che.put("id", models.get(i).getId());listdata.add(che);}}adpter.notifyDataSetChanged();}@Overridepublic void onMyFailure() {Utils.showShortToast(getActivity(), "網路錯誤");}});}

  後台(asp.net)

 private void GetDataLista(HttpContext context)        {            int _pageindex = 1;            int _pagesize = 20;            if (pageindex > 0)                _pageindex = pageindex;            if (pagesize > 0)                _pagesize = pagesize;            string where = "";            if(!string.IsNullOrEmpty(weizhi))            {                where = "weizhi like ‘%"+weizhi+"%‘";            }            string json = cheweiBll.Current.GetJSONdataForAndroid(_pageindex, _pagesize, "id asc", where);            context.Response.Write(Common.JSONhelper.CreateResponseJson("1", "", json.Replace("\"griddata\":}", "\"griddata\":[]}").ToLower()));        }

  

http://download.csdn.net/detail/shmiluwabi666/9546471

Android 讀取後台資料並顯示。類比小區車輛管理系統

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.