首页 > 代码库 > 工具类

工具类

1.点击返回键,提示用户是否要退出

	@Override	public boolean onKeyDown(int keyCode, KeyEvent event) {		if (keyCode == KeyEvent.KEYCODE_BACK) {			AlertDialog.Builder dialog = new AlertDialog.Builder(WXEntryActivity.this);			dialog.setTitle("退出");			dialog.setMessage("点击确定退出应用");			dialog.setPositiveButton("确定",					new DialogInterface.OnClickListener() {						@Override						public void onClick(DialogInterface dialog, int which) {							System.exit(0);						}					});			dialog.setNegativeButton("取消", null).show();		}		return false;	}

 

工具类