作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
}
}
如果我按下按钮返回,应用程序会停顿 10-15 秒。在日志中写:
D/ANRAppManager: !!! It is not under singleton mode, U can't use it. !!!
I/dalvikvm: threadid=3: reacting to signal 3
D/dalvikvm: dump native stack for : main
D/dalvikvm: unwind backtrace
D/dalvikvm: get native symbol
D/dalvikvm: format backtrace line
D/dalvikvm: get native done
D/dalvikvm: dump native stack for : Thread-7090
D/dalvikvm: unwind backtrace
D/dalvikvm: get native symbol
D/dalvikvm: format backtrace line
D/dalvikvm: get native done
D/dalvikvm: dump native stack for : Binder_2
D/dalvikvm: unwind backtrace
D/dalvikvm: get native symbol
D/dalvikvm: format backtrace line
D/dalvikvm: get native done
D/dalvikvm: dump native stack for : Binder_1
D/dalvikvm: unwind backtrace
D/dalvikvm: get native symbol
D/dalvikvm: format backtrace line
D/dalvikvm: get native done
D/dalvikvm: dump native stack for : Compiler
D/dalvikvm: unwind backtrace
D/dalvikvm: get native symbol
D/dalvikvm: format backtrace line
D/dalvikvm: get native done
D/dalvikvm: dump native stack for : JDWP
D/dalvikvm: unwind backtrace
D/dalvikvm: get native symbol
D/dalvikvm: format backtrace line
D/dalvikvm: get native done
D/dalvikvm: dump native stack for : GC
D/dalvikvm: unwind backtrace
D/dalvikvm: get native symbol
D/dalvikvm: format backtrace line
D/dalvikvm: get native done
D/dalvikvm: Prepare stack traces for '/data/anr/traces.txt' done
I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
和应用程序崩溃。
在此文件/data/anr/traces.txt 中:https://pastebin.com/J6qdJjU7
我正在做类似 AppLocker 的事情。我希望当按钮被按下时,这个 Activity 背后的 Activity (应用程序)关闭,而我的另一个应用程序 Activity 背后的 activity
。
使用 FLAG_NOT_FOCUSABLE
不需要的任何实现此功能的方法。怎么做到的?
最佳答案
我忘了关闭主题,但找到了另一种方法来阻止其他人的 Activity ,当我看到需要阻止的应用程序时,只需启动我自己的 Activity
关于java - FLAG_NOT_FOCUSABLE Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50362411/
public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bund
我是一名优秀的程序员,十分优秀!