I used PullToRefresh chrisBanes lib https://github.com/chrisbanes/Android-PullToRefresh . I extends PullToRefreshAttacher, cause I need specific behaviour. All works normal,when activity restored I had next stacktrace errors, but pullToRefresh still works fine (it's only in logs):
23732-23732/com.prinum.android.mb E/WindowManager﹕ android.view.WindowLeaked: Activity has leaked window android.widget.RelativeLayout{42b28870 I.E..... ......ID 0,0-1080,156} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:348)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher.addHeaderViewToActivity(PullToRefreshAttacher.java:616)
at uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacherEx.addHeaderViewToActivity(PullToRefreshAttacherEx.java:47)
at uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher$1.run(PullToRefreshAttacher.java:128)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
I tried to use standard PullToRefresh and I faced with the same problem. But if I init pullToRefresh like:
ActionBarPullToRefresh.from(this)
// Mark All Children as pullable
.allChildrenArePullable()
// Set a OnRefreshListener
.listener(...)
// Finally commit the setup to our PullToRefreshLayout
.setup(mPullToRefreshLayout);
After destroyed and restored, error stacktrace not appeared. setup() method create PullToRefreshAttacher and init some additional options.