@Override public void handleMessage(Message msg) { // TODO Auto-generated method stub super.handleMessage(msg); switch (msg.what) { case UPDATA_NONEED: Toast.makeText(getApplicationContext(), "当前为最新版本", Toast.LENGTH_SHORT).show(); UpdateVersionActivity.this.finish(); break; case UPDATA_CLIENT: // 对话框通知用户升级程序 showUpdataDialog(); break; case GET_UNDATAINFO_ERROR: // 服务器超时 Toast.makeText(getApplicationContext(), "获取服务器更新信息失败", Toast.LENGTH_LONG).show(); UpdateVersionActivity.this.finish(); break; case DOWN_ERROR: // 下载apk失败 Toast.makeText(getApplicationContext(), "下载新版本失败", Toast.LENGTH_LONG).show(); UpdateVersionActivity.this.finish(); break; } }
@Override public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // 相同的布局文件 和设置页 setContentView(R.layout.content_setting); // 版本更新 updateVersion(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_container_amuse); mycontext = this; ButterKnife.bind(this); initViews(); amuseDetailFragment = new AmuseDetailFragment(); FragmentManager fm = getSupportFragmentManager(); fm.beginTransaction().replace(R.id.fl_frag_container_amuse, amuseDetailFragment).commit(); // switch case逻辑区别 if (AugurContainerActivity.this.getIntent().getStringExtra(PAGETO) == null) { return; } mPageTo = AugurContainerActivity.this.getIntent().getStringExtra(PAGETO); if (mPageTo == null) { mPageTo = "AmuseDetailFragment"; } switchFragment(mPageTo); }