private void agencyNet( final String userno, final String name, final String toName, final String amout, final String password) { progressdialog = UserCenterDialog.onCreateDialog(this); progressdialog.show(); final Handler handler = new Handler(); new Thread( new Runnable() { @Override public void run() { // TODO Auto-generated method stub JSONObject jsonObjectByLotno = AgencyInterface.getInstance().agency(userno, name, toName, amout, password); try { String errorCode = jsonObjectByLotno.getString("error_code"); final String message = jsonObjectByLotno.getString("message"); if (errorCode.equals("0000")) { handler.post( new Runnable() { @Override public void run() { // TODO Auto-generated method stub Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); finish(); } }); } else { handler.post( new Runnable() { @Override public void run() { // TODO Auto-generated method stub Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } }); } } catch (Exception e) { e.printStackTrace(); } if (progressdialog != null) { progressdialog.dismiss(); } } }) .start(); }
/** * 联网获取期号 * * @param lotno * @param term * @param time * @param updateIssueHandler */ public void getIssue( final TrackQueryInfo info, final String issueNum, final Handler updateIssueHandler, final String beishu) { final ProgressDialog progressDialog = UserCenterDialog.onCreateDialog(context); progressDialog.show(); Thread t = new Thread( new Runnable() { @Override public void run() { try { JSONObject softupdateObj = new JSONObject(SoftwareUpdateInterface.getInstance().softwareupdate(null)); // Constants.currentLotnoInfo = // softupdateObj.getJSONObject("currentBatchCode");// 获取网络的期号信息 // JSONObject temp_obj = // Constants.currentLotnoInfo.getJSONObject(info.getLotno()); String temp_obj = GetLotNohighFrequency.getInstance().getInfo(info.getLotno()); JSONObject json = new JSONObject(temp_obj); final String issueStr = json.getString("batchcode"); progressDialog.cancel(); updateIssueHandler.post( new Runnable() { public void run() { createContinueInfo(info, issueNum, issueStr, beishu); } }); // 获取成功 } catch (Exception e) { e.printStackTrace(); updateIssueHandler.post( new Runnable() { public void run() { progressDialog.cancel(); Toast.makeText(context, "起始期号获取失败", Toast.LENGTH_SHORT).show(); } }); // 获取成功 } } }); t.start(); }
// 用户中心功能区 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.usercenter_mainlayout); context = this; usercentertop = (LinearLayout) findViewById(R.id.usercentertable); usercenterrigist_no = (LinearLayout) findViewById(R.id.regist_no); inituserpoint(); dialog = UserCenterDialog.onCreateDialog(this); // usecenerLinear = (LinearLayout)findViewById(R.id.usercenterContent); returnButton = (Button) findViewById(R.id.layout_usercenter_img_return); titleTextView = (TextView) findViewById(R.id.usercenter_mainlayou_text_title); returnButton.setBackgroundResource(R.drawable.returnselecter); scoreshow = (ImageView) findViewById(R.id.userillustrations); shellRW = new RWSharedPreferences(this, "addInfo"); initlogin_no(); initReturn(); initsroreshow(); initPojo(); // usecenerLinear.addView(showView(NewUserCenter.this)); initFuctionLayout(); MobclickAgent.onEvent(this, "yonghuzhongxin"); // BY贺思明 点击主导航上的“用户中心”。 }