logcat的说 - 应用程序可以做太多的工作,它的主线程和错误消息指出 - StringtoReal.invalidReal(string.boolean)线:63 [英] Logcat says - The application may be doing too much work on its main thread and error message says - StringtoReal.invalidReal(string.boolean)line:63

查看:167
本文介绍了logcat的说 - 应用程序可以做太多的工作,它的主线程和错误消息指出 - StringtoReal.invalidReal(string.boolean)线:63的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我运行模拟器我的应用程序, logcat的说 - 应用程序可以做太多的工作,它的主线程和 错误消息指出 - StringtoReal.invalidReal(string.boolean)线:63 在这里,我试图加3 textviews值,并使用刻度上checbox展示自己总在另一个TextView中(ES)

  10-12 17:23:21.074:W / ActivityThread(700):
应用com.suvendu.tutorial.cb正在等待调试器在端口8100 ...
10-12 17:23:21.134:我/的System.out(700):发送等待块
10-12 17:23:21.143:I / dalvikvm(700):调试器被激活
10-12 17:23:21.334:我/的System.out(700):调试器连接
10-12 17:23:21.334:我/的System.out(700):等待调试器来解决?
10-12 17:23:21.545:我/的System.out(700):等待调试器来解决?
10-12 17:23:21.744:我/的System.out(700):等待调试器来解决?
10-12 17:23:21.943:我/的System.out(700):等待调试器来解决?
10-12 17:23:22.155:我/的System.out(700):等待调试器来解决?
10-12 17:23:22.353:我/的System.out(700):等待调试器来解决?
10-12 17:23:22.554:我/的System.out(700):等待调试器来解决?
10-12 17:23:22.754:我/的System.out(700):等待调试器来解决?
10-12 17:23:22.954:我/的System.out(700):等待调试器来解决?
10-12 17:23:23.164:我/的System.out(700):调试器已落户(1368年)
10-12 17:23:25.243:I /编舞(700):跳过46帧!
该应用程序可能会做它的主线程的工作太多了。
10-12 17:23:25.533:D / gralloc_goldfish(700):没有GPU的仿真模拟器检测。
 

活动code: -

  OnClickListener checkBoxListener;
@覆盖
公共无效的onCreate(包savedInstanceState){
    super.onCreate(savedInstanceState);
    的setContentView(R.layout.main);

    text_regular_ code =(TextView中)findViewById(R.id.text_regular);
    text_small_ code =(TextView中)findViewById(R.id.text_small);
    text_large_ code =(TextView中)findViewById(R.id.text_large);

    text_check_regular_ code =(TextView中)findViewById(R.id.text_check_regular);
    text_check_small_ code =(TextView中)findViewById(R.id.text_check_small);
    text_check_large_ code =(TextView中)findViewById(R.id.text_check_large);

    text_price_regular_ code =(TextView中)findViewById(R.id.text_price_regular);
    text_price_small_ code =(TextView中)findViewById(R.id.text_price_small);
    text_price_large_ code =(TextView中)findViewById(R.id.text_price_large);



    edit_qty_regular_ code =(EditText上)findViewById(R.id.edit_qty_regular);
    edit_qty_small_ code =(EditText上)findViewById(R.id.edit_qty_small);
    edit_qty_large_ code =(EditText上)findViewById(R.id.edit_qty_large);



    chk_regular_ code =(复选框)findViewById(R.id.chk_regular);
    chk_small_ code =(复选框)findViewById(R.id.chk_small);
    chk_large_ code =(复选框)findViewById(R.id.chk_large);



    checkBoxListener =新OnClickListener(){

        公共无效的onClick(视图v){

            如果(chk_regular_ code.isChecked())
            {
                text_price_regular_ code.setText
                (text_regular_ code.getText()的toString());
                text_check_regular_ code.setText
                (chk_regular_ code.getText()的toString());

            }
            其他 {
                text_price_regular_ code.setText();
                text_check_regular_ code.setText();
                edit_qty_regular_ code.setText();
            }


            如果(chk_small_ code.isChecked())
            {
                text_price_small_ code.setText
                (text_small_ code.getText()的toString());
                text_check_small_ code.setText
                (chk_small_ code.getText()的toString());

            }
            其他 {
                text_price_small_ code.setText();
                text_check_small_ code.setText();
                edit_qty_small_ code.setText();
            }

            如果(chk_large_ code.isChecked())
            {
                text_price_large_ code.setText
                (text_large_ code.getText()的toString());
                text_check_large_ code.setText
                (chk_large_ code.getText()的toString());

            }
            其他 {
                text_price_large_ code.setText();
                text_check_large_ code.setText();
                edit_qty_large_ code.setText();
            }
            //低于code每当我用得到错误启动

            X = Double.parseDouble
                    (text_price_regular_ code.getText()的toString());
            Y = Double.parseDouble
                    (text_price_small_ code.getText()的toString());
            Z = Double.parseDouble
                    (text_price_large_ code.getText()的toString());
            A = X + Y + Z;
            text_total_ code.setText(Double.toString(一));
            //低于code每当我用得到错误终结
        }
    };

    chk_regular_ code.setOnClickListener(checkBoxListener);
    chk_small_ code.setOnClickListener(checkBoxListener);
    chk_large_ code.setOnClickListener(checkBoxListener);
}
 

解决方案

我会忽略这一点。您所看到的信息是在手机上而不是在模拟器中很重要的。模拟器是极其缓慢。没有你做的是资源密集型让您的应用程序应该在设备上进行名义上的。

在你可以使用开发者选项,在某些手机上,使你可以做太多的工作在前台可见信号的装置。在我的Galaxy Nexus的我可以导航到设置>开发人员选项>严格的运行状态。检查框将导致一个红色边框闪烁周围的任何应用程序时,它会导致像你贴出来的logcat中发生了什么消息。

去除警告的解决方案是线程,但我觉得你可能会投入精力到一个非问题。只有这样,才能知道的是设备测试。

Whenever I running my app in emulator, Logcat says - The application may be doing too much work on its main thread and error message says - StringtoReal.invalidReal(string.boolean)line:63 here, i am trying to add values of 3 textviews and show their total in another textview using tick on checbox(es)

10-12 17:23:21.074: W/ActivityThread(700): 
Application com.suvendu.tutorial.cb is waiting for the debugger on port 8100...
10-12 17:23:21.134: I/System.out(700): Sending WAIT chunk
10-12 17:23:21.143: I/dalvikvm(700): Debugger is active
10-12 17:23:21.334: I/System.out(700): Debugger has connected
10-12 17:23:21.334: I/System.out(700): waiting for debugger to settle...
10-12 17:23:21.545: I/System.out(700): waiting for debugger to settle...
10-12 17:23:21.744: I/System.out(700): waiting for debugger to settle...
10-12 17:23:21.943: I/System.out(700): waiting for debugger to settle...
10-12 17:23:22.155: I/System.out(700): waiting for debugger to settle...
10-12 17:23:22.353: I/System.out(700): waiting for debugger to settle...
10-12 17:23:22.554: I/System.out(700): waiting for debugger to settle...
10-12 17:23:22.754: I/System.out(700): waiting for debugger to settle...
10-12 17:23:22.954: I/System.out(700): waiting for debugger to settle...
10-12 17:23:23.164: I/System.out(700): debugger has settled (1368)
10-12 17:23:25.243: I/Choreographer(700): Skipped 46 frames!  
The application may be  doing too much work on its main thread.
10-12 17:23:25.533: D/gralloc_goldfish(700): Emulator without GPU emulation detected.

Activity Code:-

OnClickListener checkBoxListener;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    text_regular_code=(TextView)findViewById(R.id.text_regular);
    text_small_code=(TextView)findViewById(R.id.text_small);
    text_large_code=(TextView)findViewById(R.id.text_large);

    text_check_regular_code=(TextView)findViewById(R.id.text_check_regular);
    text_check_small_code=(TextView)findViewById(R.id.text_check_small);
    text_check_large_code=(TextView)findViewById(R.id.text_check_large);

    text_price_regular_code=(TextView)findViewById(R.id.text_price_regular);
    text_price_small_code=(TextView)findViewById(R.id.text_price_small);
    text_price_large_code=(TextView)findViewById(R.id.text_price_large);



    edit_qty_regular_code=(EditText)findViewById(R.id.edit_qty_regular);
    edit_qty_small_code=(EditText)findViewById(R.id.edit_qty_small);
    edit_qty_large_code=(EditText)findViewById(R.id.edit_qty_large);



    chk_regular_code=(CheckBox)findViewById(R.id.chk_regular);
    chk_small_code=(CheckBox)findViewById(R.id.chk_small);
    chk_large_code=(CheckBox)findViewById(R.id.chk_large);



    checkBoxListener =new OnClickListener() {

        public void onClick(View v) {

            if(chk_regular_code.isChecked())
            {
                text_price_regular_code.setText
                (text_regular_code.getText().toString());
                text_check_regular_code.setText
                (chk_regular_code.getText().toString());

            }
            else {
                text_price_regular_code.setText("");
                text_check_regular_code.setText("");
                edit_qty_regular_code.setText("");
            }


            if(chk_small_code.isChecked())
            {
                text_price_small_code.setText
                (text_small_code.getText().toString());
                text_check_small_code.setText
                (chk_small_code.getText().toString());

            }
            else {
                text_price_small_code.setText("");
                text_check_small_code.setText("");
                edit_qty_small_code.setText("");
            }

            if(chk_large_code.isChecked())
            {
                text_price_large_code.setText
                (text_large_code.getText().toString());
                text_check_large_code.setText
                (chk_large_code.getText().toString());

            }
            else {
                text_price_large_code.setText("");
                text_check_large_code.setText("");
                edit_qty_large_code.setText("");
            }
            // whenever i use below code getting error "start"

            x=Double.parseDouble
                    (text_price_regular_code.getText().toString());
            y=Double.parseDouble
                    (text_price_small_code.getText().toString());
            z=Double.parseDouble
                    (text_price_large_code.getText().toString());           
            a=x+y+z;
            text_total_code.setText(Double.toString(a));
            // whenever i use below code getting error "end"
        }
    };

    chk_regular_code.setOnClickListener(checkBoxListener);
    chk_small_code.setOnClickListener(checkBoxListener);
    chk_large_code.setOnClickListener(checkBoxListener);
}

解决方案

I would ignore that. The message you are seeing is important on phones but not in the emulator. The emulator is extremely slow. Nothing you are doing is resource intensive so your application should perform nominally on a device.

On a device you can use developer options, on some phones, to enable a visible signal that you may be doing too much work in the foreground. On my Galaxy Nexus I can navigate to Settings > Developer Options > Strict mode enabled. Checking that box will causes a red border to flash around any application when it causes a message like what you posted from your logcat to occur.

The solution for removing the warning is threading but I feel you may be devoting effort to a non issue. Only way to know is device testing.

这篇关于logcat的说 - 应用程序可以做太多的工作,它的主线程和错误消息指出 - StringtoReal.invalidReal(string.boolean)线:63的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆