放到启动事件
- 参数=0
- function onKeyDown(code,event)
- if string.find(tostring(event),"KEYCODE_BACK") ~= nil then
- if 参数+2 > tonumber(os.time()) then
- activity.finish()
- else
- if(webView.canGoBack())then
- webView.goBack()
- else
- Toast.makeText(activity,"再按一次返回键退出" , Toast.LENGTH_SHORT )
- .show()
- 参数=tonumber(os.time())
- end
- return true
- end
- end
- end
复制代码
|