coolPrat / and-bookworm

Automatically exported from code.google.com/p/and-bookworm
0 stars 0 forks source link

FC on orientation change when getting search results (after have added at least one prior book) #70

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Reproducible FC, see Summary.

Original issue reported on code.google.com by charlie....@gmail.com on 9 Jun 2010 at 4:33

GoogleCodeExporter commented 8 years ago
android.view.WindowLeaked: Activity com.totsp.bookworm.BookSearch has leaked 
window com.android.internal.policy.impl.PhoneWindow$DecorView@449ddba8 that was 
originally added here
E/WindowManager( 3891):     at android.view.ViewRoot.<init>(ViewRoot.java:247)
E/WindowManager( 3891):     at 
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
E/WindowManager( 3891):     at 
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
E/WindowManager( 3891):     at 
android.view.Window$LocalWindowManager.addView(Window.java:424)
E/WindowManager( 3891):     at android.app.Dialog.show(Dialog.java:241)
E/WindowManager( 3891):     at 
com.totsp.bookworm.BookSearch$SearchTask.onPreExecute(BookSearch.java:253)
E/WindowManager( 3891):     at android.os.AsyncTask.execute(AsyncTask.java:391)
E/WindowManager( 3891):     at 
com.totsp.bookworm.BookSearch$4.onClick(BookSearch.java:105)
E/WindowManager( 3891):     at android.view.View.performClick(View.java:2408)
E/WindowManager( 3891):     at android.view.View$PerformClick.run(View.java:8816)
E/WindowManager( 3891):     at android.os.Handler.handleCallback(Handler.java:587)
E/WindowManager( 3891):     at android.os.Handler.dispatchMessage(Handler.java:92)
E/WindowManager( 3891):     at android.os.Looper.loop(Looper.java:123)
E/WindowManager( 3891):     at 
android.app.ActivityThread.main(ActivityThread.java:4627)
E/WindowManager( 3891):     at java.lang.reflect.Method.invokeNative(Native Method)
E/WindowManager( 3891):     at java.lang.reflect.Method.invoke(Method.java:521)
E/WindowManager( 3891):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/WindowManager( 3891):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/WindowManager( 3891):     at dalvik.system.NativeStart.main(Native Method)

Original comment by charlie....@gmail.com on 9 Jun 2010 at 10:41

GoogleCodeExporter commented 8 years ago
This is really odd, since line 253 of BookSearch is a call to dialog.show of an 
AsyncTask that IS cleaned up in onPause (with a dismiss). 

Original comment by charlie....@gmail.com on 9 Jun 2010 at 10:44

GoogleCodeExporter commented 8 years ago
Found a separate instance of the AsyncTask that wasn't cleaned up, doh!

Original comment by charlie....@gmail.com on 9 Jun 2010 at 10:50

GoogleCodeExporter commented 8 years ago
Fixed that. But now sometimes get this:

 java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(2131296294, class android.widget.ListView) with Adapter(class android.widget.HeaderViewListAdapter)]
E/AndroidRuntime( 4582):    at 
android.widget.ListView.layoutChildren(ListView.java:1492)
E/AndroidRuntime( 4582):    at 
android.widget.AbsListView$CheckForTap.run(AbsListView.java:1884)
E/AndroidRuntime( 4582):    at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 4582):    at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 4582):    at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 4582):    at 
android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 4582):    at java.lang.reflect.Method.invokeNative(Native 
Method)
E/AndroidRuntime( 4582):    at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 4582):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 4582):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 4582):    at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(   83):   Force finishing activity 
com.totsp.bookworm/.BookSearch

Original comment by charlie....@gmail.com on 9 Jun 2010 at 11:16

GoogleCodeExporter commented 8 years ago
Turns out all the hoops I had to re-bind the adapter were necessary (not just a 
figment): 
http://stackoverflow.com/questions/2017633/android-listviews-header-and-footer-v
iews.  

I have rewritten a lot of Activity to not require this though, just always has 
the footerView and disables the text and click listener if no results. Now 
notify on adapter works, and FCs are gone. 

Original comment by charlie....@gmail.com on 10 Jun 2010 at 2:28