1. androd1.6怎么屏蔽HOME键?2. android中在卸载应用程序前或后怎么让它跳到一个Activity做个原因调查???
解决方案 »
- 本人想把毕业设计课题定为《基于android的蓝牙聊天室设计与开发》 请问该如何下手?
- 大牛帮忙指点一下反编译后的代码
- 求助,本人移植ffmpeg到android平台,4.0系统完美运行,2.2系统出现诡异的错误
- 求高手改写一下代码,
- 求助,Widget 显示不了
- Listview 探讨
- WHY自动生成的重写函数没有@Override?
- 运行AVD的时候,当点start后不能得到虚拟手机界面
- 执行了startActivity后,在此Activity还未显示的时候,怎么取消此界面的显示
- 有免费的播放磁力链接的API吗???
- 更新progressbar出现application not response
- onPreviewFrame 问题。
@Override
public void onAttachedToWindow() {
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
super.onAttachedToWindow();
}
这是API Level 5以后的方式,在android 1.6中不能用
if (code == KeyEvent.KEYCODE_HOME) {
// If a system window has focus, then it doesn't make sense
// right now to interact with applications.
WindowManager.LayoutParams attrs = win != null ? win.getAttrs() : null;
if (attrs != null) {
final int type = attrs.type;
if (type == WindowManager.LayoutParams.TYPE_KEYGUARD
|| type == WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG) {
// the "app" is keyguard, so give it the key
return false;
}
final int typeCount = WINDOW_TYPES_WHERE_HOME_DOESNT_WORK.length;
for (int i=0; i<typeCount; i++) {
if (type == WINDOW_TYPES_WHERE_HOME_DOESNT_WORK[i]) {
// don't do anything, but also don't pass it to the app
return true;
}
}}两个参数 WindowManager.LayoutParams.TYPE_KEYGUARD和
WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG ,重写onAttachedToWindow,以实现屏蔽Home键,但是API 5以上。
1.6只有修改源码framework层,但是不只是对你的app有效了。
还有,每一个动作都有输出流,截取输出流,如果发现卸载那个应用包的信息,做处理