通过连续按两次back键,弹出Toast提示再按一次退出功能。关键代码如下:
第一种方式:
/**
* 连续按两次返回键就退出
*/
private int keyBackClickCount = 0;
@Override
protected void onResume() {
super.onResume();
...
分类:
移动开发 时间:
2014-12-03 10:32:53
阅读次数:
179
键盘事件keycode表示一个对应的值(按下A键)getAction表示一个对应的动作(按下)@OverridepublicbooleanonKey(Viewv,intkeyCode,KeyEventevent){if(keyCode==KeyEvent.KEYCODE_BACK){Toast.makeText(getApplicationContext(),"返回",1000).show();}//switch(event.getAction(..
分类:
其他好文 时间:
2014-12-03 01:53:15
阅读次数:
116
从《C++标准库》里面看到的一些技巧,以及自己遇到的一些技巧,备忘。从流中读取数据存入容器 1 copy(istream_iterator(cin), istream_iterator(), back_inserter(vInput));//从cin中读取string 类型的数据存入 vI...
分类:
编程语言 时间:
2014-12-03 01:43:41
阅读次数:
193
#!/bin/bashmysql_host="127.0.0.1"mysql_user="root"mysql_passwd="********"back_dir="/www/backup/database/"ignore_db="information_schema|mysql|performan...
分类:
数据库 时间:
2014-12-03 00:09:08
阅读次数:
356
Bugzilla使用手册Bugzilla 是一个开源的缺陷跟踪系统(Bug-Tracking System),它可以管理软件开发中缺陷的提交(new),修复(resolve),关闭(close)等整个生命周期。 Bugzilla是一个搜集缺陷的数据库。它让用户报告软件的缺陷从而把它们转给合适的开发....
分类:
其他好文 时间:
2014-12-02 18:44:29
阅读次数:
311
Lua回调函数实例
local m = {}
local list = {name="hello",age=12}
m.call_back_fun_print = function(printID)
print(printID .. "-->" .. list[printID])
end
m.add_list = function(key,value,call_back_fun)...
分类:
其他好文 时间:
2014-12-02 17:16:40
阅读次数:
182
我们有时期望背景图片自动拉伸占据所有空间,使用CSS 3做起来并不麻烦,定义如下的CSS: body { ?? ?background:#3d71b8 url(../back_main.png); ?? ?background-size: 100%; ?? ?background-position:c...
分类:
其他好文 时间:
2014-12-02 12:10:35
阅读次数:
140
#include using namespace std;void main(void){vector array;array.push_back(1);array.push_back(2);array.push_back(3);array.push_back(4);array.push_back(...
分类:
编程语言 时间:
2014-12-01 12:45:12
阅读次数:
270
在有cache的单机系统中,通常有两种写策略:write through和write back。这两种写策略都是针对写命中(write hit)情况而言的:write through是既写cache也写main memory;write back是只写cache,并使用...
分类:
其他好文 时间:
2014-11-28 20:15:21
阅读次数:
375
The easy way to clamp a signal to a given value is to use two zener diodes, connected back-to-back. This method has several disadvantages. The accurac...
分类:
其他好文 时间:
2014-11-28 15:45:51
阅读次数:
158