We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
您好,我想问下您在app中的再按一次返回键退出这个功能是怎么实现的?我代码也是这样设置的,但是没效果啊,您在别的地方是不是也有相关的设置? 我的MainActivity里面代码是这样的:
// 再点一次退出程序时间设置 private static final long WAIT_TIME = 2000L; private long TOUCH_TIME = 0; @Override public void onBackPressedSupport() { super.onBackPressedSupport(); if (getFragmentManager().getBackStackEntryCount() > 1) { //如果当前存在fragment>1,当前fragment出栈 pop(); } else { //如果已经到root fragment了,2秒内点击2次退出 if (System.currentTimeMillis() - TOUCH_TIME < WAIT_TIME) { // setIsTransAnim(false); finish(); } else { TOUCH_TIME = System.currentTimeMillis(); Toast.makeText(this, "再按一次退出", Toast.LENGTH_SHORT).show(); } } }
The text was updated successfully, but these errors were encountered:
这句super.onBackPressedSupport(); 调用父类onBackPressedSupport删掉;
Sorry, something went wrong.
解决了,谢谢
No branches or pull requests
您好,我想问下您在app中的再按一次返回键退出这个功能是怎么实现的?我代码也是这样设置的,但是没效果啊,您在别的地方是不是也有相关的设置?
我的MainActivity里面代码是这样的:
The text was updated successfully, but these errors were encountered: