eclipse上调试器的Android错误

时间:2014-07-03 06:49:00

标签: android debugging android-asynctask

我尝试在Android应用程序中编写此Thread。

        class RunnableTemperatura  extends AsyncTask<Setting, String, ParametriAmbientali>{
        @Override
        protected ParametriAmbientali doInBackground(Setting... arg0) {

            try {
                setting = arg0[0];
                ParametriAmbientali par= null;
                par= arduino.getTemperatura(setting.getUrl()+"/"+suffissoTemperatura);
                return par;
            } catch (Exception e) {
                Log.e("OnPostExcecute thread Temperatura", "Errore",e);
            }
            return null;
        }

        @Override
        protected void onPostExecute(ParametriAmbientali par) {
            try {
                //par= arduino.getTemperatura(setting.getUrl()+"/"+suffissoTemperatura);
                textValTemperatura.setText(par.getTemperatura().toString());
                textUmidita.setText(par.getUmidita().toString());
                Thread.sleep(60*1000*setting.getSecondThreadTemperature());
                new RunnableTemperatura().execute(setting);
            } catch (Exception e) {
                Log.e("OnPostExcecute thread Temperatura", "Errore",e);
            }
        }

        @Override
        protected void onProgressUpdate(String... item) {
            //dialog.setMessage(item[0]);
        }

找到了这个AsyncTask,但是如果我在这段代码中执行调试

    try {
                    setting = arg0[0];
                    ParametriAmbientali par= null;
                    par= arduino.getTemperatura(setting.getUrl()+"/"+suffissoTemperatura);
                    return par;
                } catch (Exception e) {
                    Log.e("OnPostExcecute thread Temperatura", "Errore",e);
                }
           return null;

我注意到一个错误,调试器永远不执行&#34;返回par;&#34;但是返回null并且我没有任何错误,因此当我在OnPostExecute方法上执行调试器时,对象ParametriAmbientali会正确填充。

我们可以帮助我吗?

Reguards

0 个答案:

没有答案