@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); this.CurrentActivity = this; AppData appData = (AppData) getApplicationContext(); setUIController(appData.getController()); setType(UIConfig.customizeFormType); setContentView(R.layout.customize_list); Log.v("yujia", "customize start"); findviews(); listeners(); this.runOnUiThread( new Runnable() { @Override public void run() { // TODO Auto-generated method stub try { Thread.sleep(300); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } controller.requestAllAppInfo(); } }); }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { // Do something. AppData appData = (AppData) getApplicationContext(); appData.setInstall(true); this.finish(); // 鐩存帴璋冪敤鏉�褰撳墠activity鏂规硶. return true; } return super.onKeyDown(keyCode, event); }
@Override public void showError() { controller.logout(); AppData appData = (AppData) getApplicationContext(); appData.setInstall(false); MainActivity.isInitSuceessed = false; try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.runOnUiThread( new Runnable() { @Override public void run() { // TODO Auto-generated method stub AlertDialog.Builder builder = new AlertDialog.Builder(CustomizeActivity.this); builder.setTitle(R.string.error_load_title); builder.setMessage(R.string.error_network_content); builder.setPositiveButton( R.string.exit_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); AppData appData = (AppData) getApplicationContext(); appData.setInstall(false); MyApplicationAid.getInstance().exit(); System.exit(0); } }); builder.show(); } }); }