简体   繁体   English

异常的Android错误

[英]Unusual Android error

I have an Activity that uses a ListView to simply display a list of options for a user to select and when they select an option they are taken to a new Activity. 我有一个Activity,它使用ListView来简单显示选项列表供用户选择,当他们选择一个选项时,它们就会被带到新的Activity中。

However on occasion the Activity with the options freezes when I try to select one of the options, I get the ANR and in the log cat the following error is displayed: 但是,有时当我尝试选择一个选项时,带有选项的“活动”冻结,我得到了ANR,并且在日志猫中显示以下错误:

java.lang.RuntimeException: Performing pause of activity that is not resumed:<Activity>

Does anyone know what this error means and how to diagnose it? 有谁知道此错误的含义以及如何诊断?

A search brings up very little. 搜索很少。

Does anyone know what may be causing the error? 有谁知道是什么原因引起的错误?

I can post the code on request 我可以根据要求发布代码

Code as requested: 要求的代码:

lvMenu.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> a, View v, int position, long id) {

            switch(position){

            case 0:
                Intent intent = new Intent(this, SettingsApp.class);
                startActivity(intent);
                break;

            case 1:
                Intent intentHO = new Intent(.this, SettingsHO.class);
                startActivity(intentHO);
                break;
            case 2:
                Intent intentWifi = new Intent(this, Settings.class);
                startActivity(intentWifi);
                break;
            case 3:
                Intent intentAudio = new Intent(this, SettingsAudio.class);
                startActivity(intentAudio);
                break;
            case 4:
                Intent intentDiagnostics = new Intent(this, PhoneStatus.class);
                startActivity(intentDiagnostics);

            }

        }
        });

Seem you're doing something wrong starting a new Activity. 似乎您在执行新的活动时做错了。 Please post your onClickListener method. 请发布您的onClickListener方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM