- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
当我运行我的应用程序并按下主页按钮然后返回到我的应用程序时,我收到 RunTimeException 和 IllegalStateException 错误。
我制作了一个简单的带有声音的 Android Alphabet 游戏,在游戏结束时,会显示时间量和不正确的次数,并使用 OK 按钮将用户返回到主屏幕。但是,当我按下主页按钮然后返回我的应用程序玩游戏时,在游戏结束时用户单击确定后,我在 Logcat 中收到 RunTimeException 和 IllegalStateException 错误并且游戏返回(假设它不是重新启动我的应用程序)到游戏的主页。我在这里查看了几篇文章(例如 here )并尝试了这些解决方案,但仍然出现以下错误。我也是新手,不知道这些解决方案与我的代码有何关系。非常感谢任何帮助。
/
/ Display the game over results dialog box
public void showGameOverDialog(){
ViewGroup viewGroup = findViewById(android.R.id.content);
View dialogView = LayoutInflater.from(this).inflate(R.layout.game_over_dialog, viewGroup, false);
dialog = new AlertDialog.Builder(this);
dialog.setView(dialogView);
TextView mTextView_Mistakes = dialogView.findViewById(R.id.textView_Mistakes);
String temp = getResources().getString(R.string.mistakes) + incorrectCount;
mTextView_Mistakes.setText(temp);
TextView mTextView_timeUsed = dialogView.findViewById(R.id.textView_timeUsedText);
String temp2 = getResources().getString(R.string.time_used) + mTimeUsed;
mTextView_timeUsed.setText(temp2);
final AlertDialog alertDialog = dialog.create();
final Intent intent = new Intent(this, MainActivity.class);
final Button btnReturnToHome = dialogView.findViewById(R.id.button_return_to_home);
btnReturnToHome.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mBackground.release();
mCorrect.release();
mWrong.release();
startActivity(intent);
finish(); // <-- put this based on a suggestion in a post in this website
}
});
alertDialog.show();
}
@Override
protected void onPause() {
super.onPause();
Log.wtf("OnPause is executed--------------------", "<----------");
mBackground.reset();
mCorrect.reset();
mWrong.reset();
}
@Override
protected void onResume() {
super.onResume();
Log.wtf("OnResume is executed--------------------", "<----------");
if (noResumeFirstTime){ // This makes sure that the following mediaplayers are not started here too.
Log.wtf("Music started on resume--------------------", "<----------");
mBackground.start(); // <-- Line 365 is here ------------------
mCorrect.start();
mWrong.start();
}
noResumeFirstTime = true;
}
该应用预计会顺利返回主 Activity,但我收到以下错误。
2019-07-28 22:11:58.925 12873-12873/com.example.alphabetsforkids E/lphabetsforkid: Unknown bits set in runtime_flags: 0x8000
2019-07-28 22:12:00.003 12873-12897/com.example.alphabetsforkids E/vndksupport: Could not load /vendor/lib/egl/libGLES_emulation.so from sphal namespace: dlopen failed: library "/vendor/lib/egl/libGLES_emulation.so" not found.
2019-07-28 22:12:00.004 12873-12897/com.example.alphabetsforkids E/libEGL: load_driver(/vendor/lib/egl/libGLES_emulation.so): unknown
2019-07-28 22:12:02.358 12873-12896/com.example.alphabetsforkids E/EGL_emulation: tid 12896: eglQueryString(923): error 0x3008 (EGL_BAD_DISPLAY)
2019-07-28 22:13:42.203 13035-13061/com.example.alphabetsforkids E/vndksupport: Could not load /vendor/lib/egl/libGLES_emulation.so from sphal namespace: dlopen failed: library "/vendor/lib/egl/libGLES_emulation.so" not found.
2019-07-28 22:13:42.203 13035-13061/com.example.alphabetsforkids E/libEGL: load_driver(/vendor/lib/egl/libGLES_emulation.so): unknown
2019-07-28 22:13:43.663 13035-13060/com.example.alphabetsforkids E/EGL_emulation: tid 13060: eglQueryString(923): error 0x3008 (EGL_BAD_DISPLAY)
2019-07-28 22:13:47.845 13035-13035/com.example.alphabetsforkids E/OnResume is executed--------------------: <----------
2019-07-28 22:14:00.320 13035-13035/com.example.alphabetsforkids E/OnPause is executed--------------------: <----------
2019-07-28 22:14:05.848 13035-13035/com.example.alphabetsforkids E/OnResume is executed--------------------: <----------
2019-07-28 22:14:05.882 13035-13035/com.example.alphabetsforkids E/Music started on resume--------------------: <----------
2019-07-28 22:14:05.925 13035-13035/com.example.alphabetsforkids E/MediaPlayerNative: start called in state 1, mPlayer(0x0)
2019-07-28 22:14:05.925 13035-13035/com.example.alphabetsforkids E/MediaPlayerNative: error (-38, 0)
2019-07-28 22:14:05.927 13035-13035/com.example.alphabetsforkids E/MediaPlayerNative: start called in state 1, mPlayer(0x0)
2019-07-28 22:14:05.928 13035-13035/com.example.alphabetsforkids E/MediaPlayerNative: error (-38, 0)
2019-07-28 22:14:05.929 13035-13035/com.example.alphabetsforkids E/MediaPlayerNative: start called in state 1, mPlayer(0x0)
2019-07-28 22:14:05.930 13035-13035/com.example.alphabetsforkids E/MediaPlayerNative: error (-38, 0)
2019-07-28 22:14:06.828 13035-13035/com.example.alphabetsforkids E/MediaPlayer: Error (-38,0)
2019-07-28 22:14:06.831 13035-13035/com.example.alphabetsforkids E/MediaPlayer: Error (-38,0)
2019-07-28 22:14:20.377 13035-13035/com.example.alphabetsforkids E/MediaPlayerNative: start called in state 0, mPlayer(0x0)
2019-07-28 22:14:23.544 13035-13035/com.example.alphabetsforkids E/MediaPlayerNative: start called in state 0, mPlayer(0x0)
2019-07-28 22:14:23.553 13035-13035/com.example.alphabetsforkids E/time is greater than best time: ----
2019-07-28 22:14:25.509 13035-13035/com.example.alphabetsforkids E/OnPause is executed--------------------: <----------
2019-07-28 22:14:25.521 13035-13035/com.example.alphabetsforkids E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.alphabetsforkids, PID: 13035
java.lang.RuntimeException: Unable to pause activity {com.example.alphabetsforkids/com.example.alphabetsforkids.AlphabetGame}: java.lang.IllegalStateException
at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:4306)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:4257)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:4209)
at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:46)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1935)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7116)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925)
Caused by: java.lang.IllegalStateException
at android.media.MediaPlayer._reset(Native Method)
at android.media.MediaPlayer.reset(MediaPlayer.java:2145)
at com.example.alphabetsforkids.AlphabetGame.onPause(AlphabetGame.java:365)
at android.app.Activity.performPause(Activity.java:7874)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1500)
at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:4296)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:4257)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:4209)
at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:46)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1935)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7116)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925)
2019-07-28 22:14:26.182 13144-13168/com.example.alphabetsforkids E/vndksupport: Could not load /vendor/lib/egl/libGLES_emulation.so from sphal namespace: dlopen failed: library "/vendor/lib/egl/libGLES_emulation.so" not found.
2019-07-28 22:14:26.182 13144-13168/com.example.alphabetsforkids E/libEGL: load_driver(/vendor/lib/egl/libGLES_emulation.so): unknown
2019-07-28 22:14:26.919 13144-13167/com.example.alphabetsforkids E/EGL_emulation: tid 13167: eglQueryString(923): error 0x3008 (EGL_BAD_DISPLAY)
最佳答案
您是否在实际设备而非模拟器上试用过您的应用?我注意到您的 GLES 库无法加载,我不是 100% 适合您的情况,但 GLES 通常无法在模拟器上正常工作。
关于java - 从另一个应用程序切换回来后如何阻止我的应用程序崩溃?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57246726/
我刚开始学习JSP技术,遇到了瓶颈。 如何从 JSP 声明 block ? 这不起作用: ... 服务器说没有“out”。 U: 我确实知道如何使用返回字符串的方法重写代码,但是有没有办法在 ?
在一个字段中,我想设置一个具有自定义过滤器的自定义分析器-着眼于词干-因此,“闪存卡”和“闪存卡”的词根相同,因此返回的结果相同 当我运行以下查询时,我的命中率很高,但是“闪存卡”和“闪存卡”各自返回
快速提问。 我有一个通过 PInvoke 使用 native DLL 的应用程序,这个 DLL 可能会调用 PostQuitMessage()。 如何避免? (因为我的应用程序不应该关闭) 我试过 A
一些给定的 HTML 文章,例如: Content 与一些基本的 Jquery 结合使用,例如: $(".some_
我正在构建一个灯箱相册。当第一个图像加载时,CSS 转换起作用。当加载后的每个图像都没有。任何想法为什么?加载第一张之后的照片,但没有过渡。 Image.prototype.load = functi
这个问题在这里已经有了答案: Disable recent tasks button on Android 5.0 (2 个答案) 关闭 2 年前。 我知道这个问题之前在这里被问过 Android
我是 Objective-C 的新手,我只是想弄清楚我是否可以使用 block 或选择器作为 UIAlertView 的 UIAlertViewDelegate 参数 - 哪个更合适? 我已经尝试了以
我是 Linux (UNIX) 套接字下套接字编程的新手。我在 Internet 上找到了以下代码,用于为每个连接生成一个线程的 tcp 服务器。但是它不起作用。accept() 函数立即返回,不等待
recv()库函数手册页提到: It returns the number of bytes received. It normally returns any data available, up
我有一个用于其他项目的共享 ts 库。在这个库中有被同一个库的其他资源使用的资源。该库的结构分为 components/*、interfaces/*、services/* 等目录。在每个目录的根目录中
我想在同一行中一个接一个地显示我的 ListView ,但 ListView 显示每个新行中的每个项目。我怎样才能防止换行显示。以便它显示为段落 ListView.builder( shr
我有一个包含数千行的表格。 import React from "react" import { useSelector } from "react-redux"; import { useEffec
假设我通常希望收到关于代码中不完整模式的警告,但有时我知道某个函数的模式不完整,我知道这很好。 是still true GHC 的警告粒度是每个模块的,并且没有办法更改有关特定功能或定义的警告? 最佳
我的网络应用程序发送浏览器通知,我知道如何检查通知的浏览器权限,以及如果未授予权限,如何请求权限。 但是,即使用户授予我的站点发送通知的权限,她可能仍然无法收到通知,因为它们 might be dis
我有 Xcode 3.2.1,并且喜欢使用它,但是当我编辑文本中带有超链接的文件时(例如,带有引用的注释:# see http://example.com)Xcode 将文本变成可点击的超链接。尝试编
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许在 Stack Overflow 上提出有关通用计算硬件和软件的问题。您可以编辑问题,使其成为
我有一个在 MY_Controller 中运行的 acl。如果权限被拒绝,那么此刻,我只是执行 redirect('denied') - 这是一个非常基本的 Controller ,它加载一个非常基本
我一直很好奇尝试从 Chrome 切换到 Firefox Quantum,但是对于 Web 开发遇到了一个我无法轻松解决的主要障碍——它正在缓存我的本地主机文件,因此当我尝试在本地主机加载各种 emb
这真的让我很兴奋!在任何时候,我都会参与多个项目。当我退出Xcode时,下次打开Xcode时,我前一天的所有项目都会自动一一打开。 经常我最终编辑错误的文件,AHHHHHHHHHHH!我可以阻止这种行
我的Wiki上有500个左右的Spambot和大约5个实际注册用户。我已经使用nuke删除了他们的页面,但是他们一直在重新发布。我已经使用reCaptcha控制了spambot的注册。现在,我只需要一
我是一名优秀的程序员,十分优秀!