gpt4 book ai didi

java - FLAG_NOT_FOCUSABLE Activity

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:30:42 26 4
gpt4 key购买 nike

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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com