Get Content Sync...Because Loosing content on Screen Rotate
Opened this issue · 5 comments
Hi there, first I want to thank you for this project, second is that I am having problems when screen rotates or when I go to another app and come back, mostr of the time the content of the Editor is cleaned (even though it is on a Fragment with setRetainInstance(true) ).
I tried to save the contents on onSaveInstanceState, but since I have to get the content async that isn't a trivial thing to do.
This is an important issue . Thanks in advance
@mr5 Any thoughts on this one, please?
Hi guy, has your problem been resolved? I use webview.loadUrl
to execute javascript codes, it can't get the return values from javascript function, so you can't get contents synchronously. You can try to save contents every 500ms. I will research on how to get contents synchronously.
Thanks for ansering @mr5 , I can't get it to work yet, and i'm very sad for that since it's really bad for users to rotate the device and loose all progress (this is crucial). But I saw another Editor, the project Wordpress Editor Android (The link takes you to the exact File) they use sort of a CountDownLatch to kind of 'block'the thread for a second and wait for the callback. Look inside the getContent() method. Is that a feasible solution in this project?
If you approved this way, I think you can try it on onSaveInstanceState
: call getContent and await 1 second. But it is unreliable, so I don't want to add a synchronous method in this way.
Ok then I didn't study the guts of how this editor works, but I would like to help you fix this. when you have any Ideias on this, tell me!