《安卓android网上订餐点餐菜系统源代码.docx》由会员分享,可在线阅读,更多相关《安卓android网上订餐点餐菜系统源代码.docx(9页珍藏版)》请在课桌文档上搜索。
1、privateclassIoadAsyncTaskextendsAsyncTask0OverrideprotectedvoidonPreExecute()dialog=PrOgreSSDiaIog.s/?。W(DiSheSLiStACtivity.this,“提示二”获取中“);0VerrideprotectedStringdoInBackground(String.params)Stringjson=null;ServerUrl=AppConstant.gettrL(getApplicationContext()+ServletService?Action=getdisheslist&msg
2、=+params0;json=httpHelper.HttpRequest(ServerUrl);returnjson;0OverrideprotectedvoidOnPostExecute(Stringresult)super.OnPostExecute(result);dialog.dismiss();list=newArrayList();if(result!=null&result.trim().length()0)tryjSonArray=newJSoNArray(result);for(inti=0;i0VerrideprotectedvoidonPreEecute()dialog
3、=ProgressDialog.sho(PlaceOrderActivity.this,提示“,”获取中,请稍后.”);0VerrideprotectedStringdoInBackground(String.params)StringUrlString=AppConstant.gett/rL(getApplicationContext()+,ServletServicePAction=getOneRow;UrlString=UrlString+&Table=seats;Stringjson=httpHelper.HttpRequest(UrlString);returnjson;0Verri
4、deprotectedvoidOnPostExecute(Stringresult)super.OnPostExecute(result);dialog.dismiss();if(result.trim().length()0)tryjSonArray=newJSONArray(result);LinearLayout11=null;for(inti=0;iInteger.VaIUeof(id);setSel(););11.addView(imageview);if(i%6=0)IlSeat.addView(ll);catch(JSONExceptione)e.printStackTrace(
5、);privateclassIoadAsyncTaskextendsASynCTaSk0OverrideprotectedvoidonPreExecute()dialog=ProgressDialog.shk(MyOrdersListActivity.this,“提示“,”获取中.);0OverrideprotectedStringdoInBackground(String.params)Stringjson=null;ServerUrl=AppConstant.gettrL(getApplicationContext()+ServletService?Action=getmyordersli
6、st&userid=+user.getld();json=httpHelper.HttpRequest(ServerUrl);returnjson;0OverrideprotectedvoidOnPostExecute(Stringresult)super.OnPostExecute(result);dialog.dismiss();list=newArrayList();if(result!=null&result.trim().length()0)tryjsonArray=new3SONArray(result);for(inti=0;ijSonArray.length();i+)json
7、Object=jsonArray.getJSONObject(i);ordersmodel=neworders();model,setld(jsonObject.getlnt(,idu);model.SetAmount(jsonObject.getDouble(amount);model.SetCreatetime(jsonObjectgetString(createtime);model.setSeat(jsonObject.getString(,seat);model.setPrice(jsonObject.getDouble(price);model.SetUsername(jsonOb
8、ject.getString(title);model.setlmg_url(jsonObject.getString(img_url);model.setStatus(jsonObject.getlnt(,status,);list.add(model);catch(JSONExceptione)e.printStackTrace();elsetoastUtiLShoW(没有数据”);adapter=newOrdersAdapter(MyOrdersListActivity.thislist);Iistviewl.setAdapter(adapter);packagecom.mm.meala
9、pp.activity;importorg.json.JSONArray;importorg.json.JSONException;importandroid.app.ProgressDialog;importandroid.content.Intent;importandroid.graphics.BitmapFactory;importandroid.os.AsyncTask;importandroid.os.Bundle;importandroid.text.TextUtils;importandroid.view.View;importandroid.widget.Button;imp
10、ortandroid,widget.ImageView;importandroid.widget.TextView;importcom.miebo.utils.AsyncImageLoader;importcom.miebo.utils.BaseActivity;*authorzlus*/publicclassGoodDetailActivityextendsBaseActivityprivateintid=O;privateImageViewimageViewl;privateAsyncImageLoaderasyncImageLoader;privateStringserverUrl;pr
11、ivateTextViewtvlntro;privateButtonbtnTopTitleRight,btnTopTitleLeft;privatecom.mm.mealapp.activity.CommonApplicationapplication;OverridepublicvoidonCreate(BundleSavedInstanceState)super.onCreate(savedInstanceState);setContentView(R.layout.activity-gddetail);application=(com.mm.mealapp.activity.Common
12、Application)getApplicationContext();findview();asyncImageLoader=newAsyncImageLoader(BitmapFactory.decodeResource(getResources(),R.drawable.pc_loading_fali);ServerUrl=AppConstant.getRootUrl(this);if(getlntent()!=null)id=getIntent().getIntExtra(,id,O);newloadAsyncTask().execute(id+,n);privatevoidfindv
13、iew()imageViewl=(ImageView)findViewBy!d(R.id.imageViewl);tvlntro=(TextView)findViewById(R.id.tvIntro);btnTopTitleRight=(Button)findViewById(R.id.btnTopTitleRight);btnTopTitleRight.setText(T);btnTopTitleRight.setVisibility(View.VISIBLE);btnTopTitleRight.setOnClickListener(this);btnTopTitleLeft=(Butto
14、n)findViewById(R.id.btnTopTitleLeft);btnTopTitleLeft.setVisibility(View.VISIBLE);btnTopTitleLeft.setOnCIickListener(this);btnTopTitleLeft.setText(ll,);)privateclassIoadAsyncTaskextendsAsyncTask0VerrideprotectedvoidonPreExecute()(dialog=PrOgreSSDialog.show(GoodDetailActivity.this,提示获取中,请稍后)(S)Overrid
15、eprotectedStringdoInBackground(String.params)StringUrlString=AppConstant.getUrl(getApplicationContext(),Se,letService7Action=getOneRow;UrlString=UrIString+,0)try(jsonArray=newJSONArrayCresuIt);jsonbject=jsonArray.getJSONObject(O);(TextView)findViewById(R.id.tvTopTitleCenter).setText(jsonObject.getSt
16、ring(,title);(TextView)findViewById(R.id.tvTopTitleCenter).setTextSize(l6);if(!TextUtils.isEmpty(jsonObject.getString(img-ur,)asyncImageLoader.loadBitmap(serverUrl+nUploadFile/jsonObject.getString(img_url),imageViewl);(Stringintro=单价:+jsonObject.getString(price)+nH;intro+=数量:+jsonObject.getString(am
17、ount)+,n;intro+=简介:+jsonObject.getString(intro);tvIntro.setText(intro);catch(JSONExceptione)e.printStackTrace();1)1(S)OverridepublicvoidonClick(Viewv)switch(v.getld()caseR.id.btnTopTitleRight:intent=newIntenl(GOOdDetaiIACliVity.this,PlaceOrderActivity.class);intent.putExtra(id,id);StartActivityForResuItCintent,1);break;caseR.id.btnTopTitleLeft:finish();break;default:break;