View not attached to window manager

timo

Active Member
Licensed User
Longtime User
It seems that this error that I encontered today occours sometimes when a user closes and suddenly reopens or orientation changes while process is running. I had a look on the web and didn't find a real solution for android. Is there anyone who have had the same problem?

(for example: http://bend-ing.blogspot.com/2008/11/properly-handle-progress-dialog-in.html
and http://stackoverflow.com/questions/...exception-view-not-attached-to-window-manager
or http://stackoverflow.com/questions/...exception-view-not-attached-to-window-manager)
 
Last edited:

timo

Active Member
Licensed User
Longtime User
It happens when you want to intercept an unexpected back_button pressure from user, then you save/update data on a DB by calling a sub save() from Pause(). The problem doesn't exist if you avoid calling a progressdialogshow. It desn't matter where you put the progress.d.s.(i.e. begin/end of the procedure).
You have then to recall the finished Activity from elsewhere (reloading data from DB).
 
Last edited:
Upvote 0

timo

Active Member
Licensed User
Longtime User
I will try to post one ad hoc simpler in the next days.
I coded this way not only to intercept the back btn, but a screen timeout too (if I didn't want to put an Awake[reflections] inside).
Thank you.
 
Upvote 0

timo

Active Member
Licensed User
Longtime User
Life is strange. Here I tried to reduce the code at the minimum and the error does'nt want to appear. Maybe because this code is too small and is working only on a single table. I will try to do 'better' when I have more time (It souds strange when 'better' means error,eh!eh!)
Anyway, now that I have made it I will post it.
 

Attachments

  • test.zip
    9.3 KB · Views: 199
Last edited:
Upvote 0

timo

Active Member
Licensed User
Longtime User
test.db was in the files folder, but zip didn't strangely include it. I've done it a second time with the same result. So i post it separately here (bug?)

The error occoured when pushing back while compiling a new form (here only one edittext). In pause I called an input controller sub putting zero values in the still empty views before saving to the db. When I reloaded the form (Activity) the error appeared, but only if i putted a progressdialog. I have to say that the program was far more coplicated, with several tables to manage in savings methods. Maybe my habit to use mostly native sqlite language have some to do with it, but I don't think. (encountered some problems with inner join too, but still to verify)

P.S. DB seems to be an invalid file to upload (see picture).
So I attached a structure picture (DB is with no data in it).
 

Attachments

  • invalid.jpg
    10.6 KB · Views: 201
  • dbStruct.jpg
    27.4 KB · Views: 171
Last edited:
Upvote 0

joseluis

Active Member
Licensed User
Longtime User
Aside from the file being in the Files folder you must also load it from the Files TAB in the IDE, so it will be included in the exported zip.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…