0

当我尝试更改方向并调用异步活动时,出现此错误。用户单击refresh to get data and he tries to change the orientation,我收到此错误。

我回顾了我的代码....我notifyDataSetChanged只在onPostExecute().

@Override
protected void onPostExecute(Boolean result) {
    super.onPostExecute(result);
    adapater.notifyDataSetChanged(); 
}

日志猫

  06-12 18:19:11.777: E/XXX(10529):
  slidingmenu.lib.CustomViewAbove.onLayout(CustomViewAbove.java:476)
  06-12 18:19:11.777: E/XXX(10529):     at
  android.view.View.layout(View.java:13754) 06-12 18:19:11.777:
  E/XXX(10529):     at android.view.ViewGroup.layout(ViewGroup.java:4362)
  06-12 18:19:11.777: E/XXX(10529):     at
  android.widget.RelativeLayout.onLayout(RelativeLayout.java:948) 06-12
  18:19:11.777: E/XXX(10529):   at
  android.view.View.layout(View.java:13754) 06-12 18:19:11.777:
  E/XXX(10529):     at android.view.ViewGroup.layout(ViewGroup.java:4362)
  06-12 18:19:11.777: E/XXX(10529):     at
  android.widget.FrameLayout.onLayout(FrameLayout.java:448) 06-12
  18:19:11.777: E/XXX(10529):   at
  android.view.View.layout(View.java:13754) 06-12 18:19:11.777:
  E/XXX(10529):     at android.view.ViewGroup.layout(ViewGroup.java:4362)
  06-12 18:19:11.777: E/XXX(10529):     at
  android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1866) 06-12
  18:19:11.777: E/XXX(10529):   at
  android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1687)
  06-12 18:19:11.777: E/XXX(10529):     at
  android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998) 06-12
  18:19:11.777: E/XXX(10529):   at
  android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212)
  06-12 18:19:11.777: E/XXX(10529):     at
  android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
  06-12 18:19:11.777: E/XXX(10529):     at
  android.view.Choreographer.doCallbacks(Choreographer.java:555) 06-12
  18:19:11.777: E/XXX(10529):   at
  android.view.Choreographer.doFrame(Choreographer.java:525) 06-12
  18:19:11.777: E/XXX(10529):   at
  android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
  06-12 18:19:11.777: E/XXX(10529):     at
  android.os.Handler.handleCallback(Handler.java:615) 06-12
  18:19:11.777: E/XXX(10529):   at
  android.os.Handler.dispatchMessage(Handler.java:92) 06-12
  18:19:11.777: E/XXX(10529):   at
  android.os.Looper.loop(Looper.java:137) 06-12 18:19:11.777:
  E/XXX(10529):     at
  android.app.ActivityThread.main(ActivityThread.java:4928) 06-12
  18:19:11.777: E/XXX(10529):   at
  java.lang.reflect.Method.invokeNative(Native Method) 06-12
  18:19:11.777: E/XXX(10529):   at
  java.lang.reflect.Method.invoke(Method.java:511) 06-12 18:19:11.777:
  E/XXX(10529):     at
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
  06-12 18:19:11.777: E/XXX(10529):     at
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558) 06-12
  18:19:11.777: E/XXX(10529):   at dalvik.system.NativeStart.main(Native
   Method)

我的 doInBackgroundClass

@
Override
protected Boolean doInBackground(String...params) {
    if (Utils.UpdateDate(params)) {
        return true;
    }
    return false;
}
4

1 回答 1

1

将您的adapter.notifyDataSetChanged()调用从onPostExecute()方法移动到您修改适配器的任何方法。

于 2013-06-12T13:12:44.563 回答