Interactive Ink

IllegalArgumentException: package is already opened

Due to specific life-cycle of the activity, I am initializing iInk and package(to a specific file) on activity start but at certain moment im restarting the activity but i cannot get initialize the same file as a package, even though i close it and reinitialize. 

Is there a way to check it or something, because i tried several ways but couldnt efficiently handle it without changing the file itself.

I will attach a screenshot with order of life cycle. So after first activity initializes - i am not able to open the same package file again even after  releasing. Is there a way to do that? Thank you in advance

report.PNG
(53.1 KB)

image


Dear Zharas,


thank you for contacting.


I am sorry, but your explanation is not very clear... I am trying to guess what you are trying to do, but I am not sur to understand.


From what I suppose, you created a part, attach it to an editor. Then, re-started the activty... Did you try to re-attach the previous parts to a new editor? Based on the screenshot, it appears your editor does not have any part attached to it...


Please explain, as this is not clear...


Best regards,


Olivier


1 person likes this
Yes. Lets suppose Im initialized default package and part on runtime called “book001.iink” on mainactivity; and engine as static class of applicatiob; its working well, but for some purpose (login/localization) i had to destroy mainActivity and on second launch again initialize/open/create “book001.iink” package, but either way its giving error that its already open. But my contentPackage and contentPart both are null cause activity had stopped and destroyed. Therefore if i try to recognize its giving exception cause no part attached. Problem is that im failing to open or create same package file again. Before destroying first time i called both part and package close() functions.
Dear Zharas,

maybe that there is something that keeps the file in the cache. Can you please ensure the Editor is closed too? Or at least you can just set it as follows: editor.setPart(null).

Let us know if this doesn't work.

Best regards,

Olivier

 


2 people like this

Good morning~

You have pointed exactly on a point, editor.setPart resolved the issue! 

Greatly appreciate your help!

Login or Signup to post a comment