【问题标题】:How to restore when activity is destroyed or paused?当活动被破坏或暂停时如何恢复?
【发布时间】:2011-06-21 01:27:39
【问题描述】:

好的,这就是我想要做的.....

        new AsyncTask<Void, Integer, Void>(){

            @Override
        protected Void doInBackground(Void... arg0) {
            try {                 
             Thread.sleep(1000);             
            } catch (InterruptedException e) {                         
                e.printStackTrace();             
                    }            
                    return null;
            }
            @Override         
        protected void onPostExecute(Void result) {             
                    text1.setText("Nice to meet you "+name);
                    dismissDialog(typeBar);
                     }


                @Override        
        protected void onPreExecute() { 
            typeBar = 0;
        showDialog(typeBar);

        }

        }.execute((Void)null);

        }
    });
    }

问题出在我的应用程序中,textView 发生了很大变化!。每次单击按钮时..我不想在每次 textView 更改时纠正 AsyncTask。那将是乏味的并且使用很多资源。有谁是我可以实现它的更好方法吗?

【问题讨论】:

    标签: android android-asynctask savestate


    【解决方案1】:

    这有点类似于我之前的帖子答案之一(相同的想法):

    How to save Alarm after app killing?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多