博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
主Activity双击退出程序
阅读量:1980 次
发布时间:2019-04-27

本文共 342 字,大约阅读时间需要 1 分钟。

主Activity双击退出程序

private long mPreTime;@Overridepublic void onBackPressed() {	if (this instanceof MainActivity) {		if (System.currentTimeMillis() - mPreTime > 2000) {// 两次点击间隔大于2秒			Toast.makeText(getApplicationContext(), "再按一次,退出应用程序", 0)					.show();			mPreTime = System.currentTimeMillis();			return;		}	}	super.onBackPressed();// finish()}

转载地址:http://iphpf.baihongyu.com/

你可能感兴趣的文章
Python的多线程不是真的多线程(GIL全局解释器锁)
查看>>
Python手动读取MNIST数据集
查看>>
Python手动读取CIFAR-10数据集
查看>>
Pytorch(十一) —— 分布式(多GPU)训练
查看>>
Deeplab v3
查看>>
Pytorch之经典神经网络语义分割(3.2) —— ASPP 空洞空间金字塔池化(atrous spatial pyramid pooling )
查看>>
NLP 之 Perplexity困惑度
查看>>
tensor/矩阵/图片等更换通道,调整size
查看>>
本地和colab 中 改变tensorflow的版本
查看>>
Camera-ready ddl
查看>>
CUB-200鸟类数据集
查看>>
Python反射机制
查看>>
YAPF —— Python代码格式化工具
查看>>
UGC 用户产生内容
查看>>
ranger
查看>>
slurm
查看>>
xfce4
查看>>
xrdp
查看>>
Raft算法
查看>>
Python计算文本BLEU分数
查看>>