public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.buy_footballlottery_layout); initBatchCode(Constants.LOTNO_LCB); iScreenWidth = PublicMethod.getDisplayWidth(this); TextView text_sixhalf = (TextView) findViewById(R.id.string_banquanchang); text_sixhalf.setVisibility(TextView.VISIBLE); ImageView divide = (ImageView) findViewById(R.id.image_divide_sixhalf); divide.setVisibility(ImageView.VISIBLE); JSONObject rx9LotnoInfo = PublicMethod.getCurrentLotnoBatchCode(Constants.LOTNO_LCB); if (rx9LotnoInfo != null) { // 成功获取到了期号信息 try { batchCode = rx9LotnoInfo.getString("batchCode"); qihaoxinxi[0] = batchCode; qihaoxinxi[1] = rx9LotnoInfo.getString("endTime"); qihaoxinxi[2] = Constants.LOTNO_LCB; } catch (JSONException e) { qihaoxinxi[0] = ""; qihaoxinxi[1] = ""; qihaoxinxi[2] = Constants.LOTNO_LCB; } } layout_football_issue = (Button) findViewById(R.id.layout_football_issue); layout_football_time = (TextView) findViewById(R.id.layout_football_time); batchCode = qihaoxinxi[0]; initBatchCodeView(); createView(); getData(qihaoxinxi[2], qihaoxinxi[0]); }
/** 获取期号 */ public void getIssue(TrackQueryInfo info, String issueNum, String beishu) { // 获取期号和截止时间 JSONObject ssqLotnoInfo = PublicMethod.getCurrentLotnoBatchCode(info.getLotno()); if (ssqLotnoInfo != null && ssqLotnoInfo.has(info.getLotno())) { // 成功获取到了期号信息 try { String issueStr = ssqLotnoInfo.getString("batchCode"); createContinueInfo(info, issueNum, issueStr, beishu); } catch (JSONException e) { e.printStackTrace(); } } else { // 没有获取到期号信息,重新联网获取期号 getIssue(info, issueNum, new Handler(), beishu); } }
/** * 赋值给当前期 * * @param type彩种编号 */ public void setIssue(String type) { // 获取期号和截止时间 JSONObject ssqLotnoInfo = PublicMethod.getCurrentLotnoBatchCode(type); if (ssqLotnoInfo != null && ssqLotnoInfo.has(type)) { // 成功获取到了期号信息 try { String issueStr = ssqLotnoInfo.getString("batchCode"); String timeStr = ssqLotnoInfo.getString("endTime"); issue.setText("第" + issueStr + "期"); time.setText("截止时间:" + timeStr); } catch (JSONException e) { e.printStackTrace(); } } else { // 没有获取到期号信息,重新联网获取期号 PublicMethod.getIssue(type, issue, time, new Handler()); } }