private void loadData(String url) { if (hasNetWork()) { loadNewDetailData(url); } else { showShortToast(getString(R.string.not_network)); String result = getCacheStr("WeatherActivity"); if (!StringUtils.isEmpty(result)) { getResult(result); } } }
@AfterViews public void initView() { try { initViewPager(); String titleName = getCacheStr("titleName"); if (StringUtils.isEmpty(titleName)) { titleName = "北京"; } mTitle.setText(titleName + "天气"); mLocal.setVisibility(View.VISIBLE); setBack(titleName); loadData(getWeatherUrl(titleName)); mWeatherDate.setText(TimeUtils.getCurrentTime()); } catch (Exception e) { e.printStackTrace(); } }