安卓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

提交評論