Toast.makeText(context, "Failed to open package"+e, Toast.LENGTH_LONG).show();
}
Best Answer
O
Olivier @MyScript
said
over 2 years ago
Dear Rathish,
thank you for contacting us and your question.
Currently, I am not sure to understand what you are trying to do? Indeed, it seems like you want to open a txt file? What is the content of the latter?
First, I recommend you refer to our documentation to understand whart is a contentPackage: https://developer.myscript.com/docs/interactive-ink/1.4/android/fundamentals/storage/#structure-of-the-model Indeed, bascically the contentPackage shall be in the "MyScript iink" format. For this: -You shall first create a contentPackage: ContentPackage contentPackage = engine.createPackage(newContentPackageFile); -When no longer used, you shall save it properly.
-Then, when you need it later, you can open a contentPackage that was stored on your device: ContentPackage existingPackage = engine.openPackage(existingContentPackageFile);
If the contentPackage was properly created and saved, there is no reason you cannot open it properly later.
Best regards,
Olivier
1 Comment
O
Olivier @MyScript
said
over 2 years ago
Answer
Dear Rathish,
thank you for contacting us and your question.
Currently, I am not sure to understand what you are trying to do? Indeed, it seems like you want to open a txt file? What is the content of the latter?
First, I recommend you refer to our documentation to understand whart is a contentPackage: https://developer.myscript.com/docs/interactive-ink/1.4/android/fundamentals/storage/#structure-of-the-model Indeed, bascically the contentPackage shall be in the "MyScript iink" format. For this: -You shall first create a contentPackage: ContentPackage contentPackage = engine.createPackage(newContentPackageFile); -When no longer used, you shall save it properly.
-Then, when you need it later, you can open a contentPackage that was stored on your device: ContentPackage existingPackage = engine.openPackage(existingContentPackageFile);
If the contentPackage was properly created and saved, there is no reason you cannot open it properly later.
Rathish Krish
Hi,
version : 1.4.1
I am trying to open existing saved file .But I am getting exception
java.io.IOException: content package archive corrupted
filepath : /storage/emulated/0/Android/data/com.myscript.iink.demo/files/File1.txt
File newFile = files[selected[0]];
try
{
ContentPackage newPackage = editor.getEngine().openPackage(newFile);
ContentPart newPart = newPackage.getPart(0);
setPart(newFile, newPackage, newPart);
}
catch (IOException e)
{
Toast.makeText(context, "Failed to open package"+e, Toast.LENGTH_LONG).show();
}
Dear Rathish,
thank you for contacting us and your question.
Currently, I am not sure to understand what you are trying to do? Indeed, it seems like you want to open a txt file? What is the content of the latter?
First, I recommend you refer to our documentation to understand whart is a contentPackage: https://developer.myscript.com/docs/interactive-ink/1.4/android/fundamentals/storage/#structure-of-the-model
Indeed, bascically the contentPackage shall be in the "MyScript iink" format. For this:
-You shall first create a contentPackage: ContentPackage contentPackage = engine.createPackage(newContentPackageFile);
-When no longer used, you shall save it properly.
-Then, when you need it later, you can open a contentPackage that was stored on your device: ContentPackage existingPackage = engine.openPackage(existingContentPackageFile);
If the contentPackage was properly created and saved, there is no reason you cannot open it properly later.
Best regards,
Olivier
Olivier @MyScript
Dear Rathish,
thank you for contacting us and your question.
Currently, I am not sure to understand what you are trying to do? Indeed, it seems like you want to open a txt file? What is the content of the latter?
First, I recommend you refer to our documentation to understand whart is a contentPackage: https://developer.myscript.com/docs/interactive-ink/1.4/android/fundamentals/storage/#structure-of-the-model
Indeed, bascically the contentPackage shall be in the "MyScript iink" format. For this:
-You shall first create a contentPackage: ContentPackage contentPackage = engine.createPackage(newContentPackageFile);
-When no longer used, you shall save it properly.
-Then, when you need it later, you can open a contentPackage that was stored on your device: ContentPackage existingPackage = engine.openPackage(existingContentPackageFile);
If the contentPackage was properly created and saved, there is no reason you cannot open it properly later.
Best regards,
Olivier
1 person likes this