安卓android网上订餐点餐菜系统源代码_第1页
安卓android网上订餐点餐菜系统源代码_第2页
安卓android网上订餐点餐菜系统源代码_第3页
安卓android网上订餐点餐菜系统源代码_第4页
安卓android网上订餐点餐菜系统源代码_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、PAGE II private class loadAsyncTask extends AsyncTask Overrideprotected void onPreExecute() dialog = ProgressDialog.show(DishesListActivity.this, 提示, 获取中.);Overrideprotected String doInBackground(String. params) String json = null;serverUrl = AppConstant.getUrl(getApplicationContext() + ServletServi

2、ce?Action=getdisheslist&msg=+ params0;json = httpHelper.HttpRequest(serverUrl);return json;Overrideprotected void onPostExecute(String result) super.onPostExecute(result);dialog.dismiss();list = new ArrayList();if (result != null & result.trim().length() 0) try jsonArray = new JSONArray(result);for

3、(int i = 0; i jsonArray.length(); i+) jsonObject = jsonArray.getJSONObject(i);dishes model = new dishes();model.setId(jsonObject.getInt(id);model.setIntro(jsonObject.getString(intro);model.setImg_url(jsonObject.getString(img_url);model.setTitle(jsonObject.getString(title);model.setPrice(jsonObject.g

4、etDouble(price);list.add(model); catch (JSONException e) e.printStackTrace(); else toastUtil.show(没有数据);adapter = new DishesAdapter(DishesListActivity.this, list);listview1.setAdapter(adapter);private class loadAsyncTask extends AsyncTask Overrideprotected void onPreExecute() dialog = ProgressDialog

5、.show(PlaceOrderActivity.this, 提示, 获取中,请稍后.);Overrideprotected String doInBackground(String. params) String urlString = AppConstant.getUrl(getApplicationContext() + ServletService?Action=getOneRow;urlString = urlString + &Table=seats;String json = httpHelper.HttpRequest(urlString);return json;Overri

6、deprotected void onPostExecute(String result) super.onPostExecute(result);dialog.dismiss();if (result.trim().length() 0) try jsonArray = new JSONArray(result);LinearLayout ll = null;for (int i = 0; i jsonArray.length(); i+) jsonObject = jsonArray.getJSONObject(i);if (i % 6 = 0) ll = new LinearLayout

7、(PlaceOrderActivity.this);ll.setOrientation(LinearLayout.HORIZONTAL);ll.setGravity(Gravity.CENTER);final ImageView imageView = new ImageView(PlaceOrderActivity.this);imageView.setPadding(5, 5, 5, 5);imageView.setTag(jsonObject.getInt(id) + , + jsonObject.getInt(state) + ,0);if (jsonObject.getInt(sta

8、te) = 0) imageView.setImageResource(R.drawable.seat_unavailable); else imageView.setImageResource(R.drawable.seat_sel);imageView.setOnClickListener(new OnClickListener() Overridepublic void onClick(View v) String tag = v.getTag().toString();String id = tag.split(,)0;String state = tag.split(,)1;/ 是否

9、被选择String sel = tag.split(,)2;/ 是否选中if (1.equals(state) toastUtil.show(该座位已被选); else if (1.equals(sel) imageView.setImageResource(R.drawable.seat_unavailable);imageView.setTag(id + , + state + , + 0);hashMap.remove(Integer.valueOf(id);setSel(); else imageView.setImageResource(R.drawable.seat_selecte

10、d);imageView.setTag(id + , + state + , + 1);hashMap.put(Integer.valueOf(id), Integer.valueOf(id);setSel(););ll.addView(imageView);if (i % 6 = 0) llSeat.addView(ll); catch (JSONException e) e.printStackTrace();private class loadAsyncTask extends AsyncTask Overrideprotected void onPreExecute() dialog

11、= ProgressDialog.show(MyOrdersListActivity.this, 提示, 获取中.);Overrideprotected String doInBackground(String. params) String json = null;serverUrl = AppConstant.getUrl(getApplicationContext() + ServletService?Action=getmyorderslist&userid=+ user.getId();json = httpHelper.HttpRequest(serverUrl);return j

12、son;Overrideprotected void onPostExecute(String result) super.onPostExecute(result);dialog.dismiss();list = new ArrayList();if (result != null & result.trim().length() 0) try jsonArray = new JSONArray(result);for (int i = 0; i jsonArray.length(); i+) jsonObject = jsonArray.getJSONObject(i);orders mo

13、del = new orders();model.setId(jsonObject.getInt(id);model.setAmount(jsonObject.getDouble(amount);model.setCreatetime(jsonObject.getString(createtime);model.setSeat(jsonObject.getString(seat);model.setPrice(jsonObject.getDouble(price);model.setUsername(jsonObject.getString(title);model.setImg_url(js

14、onObject.getString(img_url);model.setStatus(jsonObject.getInt(status);list.add(model); catch (JSONException e) e.printStackTrace(); else toastUtil.show(没有数据);adapter = new OrdersAdapter(MyOrdersListActivity.this, list);listview1.setAdapter(adapter);package com.mm.mealapp.activity;import org.json.JSO

15、NArray;import org.json.JSONException;import android.app.ProgressDialog;import android.content.Intent;import android.graphics.BitmapFactory;import android.os.AsyncTask;import android.os.Bundle;import android.text.TextUtils;import android.view.View;import android.widget.Button;import android.widget.Im

16、ageView;import android.widget.TextView;import com.miebo.utils.AsyncImageLoader;import com.miebo.utils.BaseActivity;/* * * author zlus * */public class GoodDetailActivity extends BaseActivity private int id = 0;private ImageView imageView1;private AsyncImageLoader asyncImageLoader;private String serv

17、erUrl;private TextView tvIntro;private Button btnTopTitleRight, btnTopTitleLeft;private com.mm.mealapp.activity.CommonApplication application;Overridepublic void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState);setContentView(R.layout.activity_gooddetail);application = (com.mm.

18、mealapp.activity.CommonApplication) getApplicationContext();findview();asyncImageLoader = new AsyncImageLoader(BitmapFactory.decodeResource(getResources(), R.drawable.pc_loading_fali);serverUrl = AppConstant.getRootUrl(this);if (getIntent() != null) id = getIntent().getIntExtra(id, 0);new loadAsyncT

19、ask().execute(id + );private void findview() imageView1 = (ImageView) findViewById(R.id.imageView1);tvIntro = (TextView) findViewById(R.id.tvIntro);btnTopTitleRight = (Button) findViewById(R.id.btnTopTitleRight);btnTopTitleRight.setText(下单);btnTopTitleRight.setVisibility(View.VISIBLE);btnTopTitleRig

20、ht.setOnClickListener(this);btnTopTitleLeft = (Button) findViewById(R.id.btnTopTitleLeft);btnTopTitleLeft.setVisibility(View.VISIBLE);btnTopTitleLeft.setOnClickListener(this);btnTopTitleLeft.setText(返回);private class loadAsyncTask extends AsyncTask Overrideprotected void onPreExecute() dialog = Prog

21、ressDialog.show(GoodDetailActivity.this, 提示, 获取中,请稍后.);Overrideprotected String doInBackground(String. params) String urlString = AppConstant.getUrl(getApplicationContext() + ServletService?Action=getOneRow;urlString = urlString + &ID= + params0 + &Table=dishes;String json = httpHelper.HttpRequest(urlString);return json;Overrideprotected void onPostExecute(String result) super.onPostExecute(result);dialog.dismiss();if (result.trim().length() 0) try jsonArray = new JSONArray(result);jsonObject = jsonArray.getJSONObject(0);(TextView) findViewById(R.id.tvTopTitleCenter).se

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论