but when i run it in debug mode, it seems to be fine
this is my code:
private void bulletAdding (@NotNull Editor editor, int kindHead) {
String exportResult = null;
try {
exportResult = editor.export_(null, MimeType.TEXT);
} catch (IOException e) {
//e.printStackTrace();
}
String export = null;
if (exportResult != null) {
if (kindHead == 1) {
export = exportResult.replace("\n", "\n•");
export = "•" + export;
}
if (kindHead == 2) {
String[] replaced;
replaced = exportResult.split("");
int count = 1;
int i = 0;
while (i < replaced.length) {
if (replaced[i].equals("\n")) {
count++;
replaced[i] = "\n" + count + ".";
}
i++;
}
export = "1.";
i = 0;
while (i < replaced.length) {
if (!replaced[i].equals("") && !replaced[i].equals(" ")) {
export = export + replaced[i];
}
i++;
}
}
}
editor.clear();
editor.import_(MimeType.TEXT, export, null);
can you help me with this?
Best Answer
G
Gwenaelle @MyScript
said
over 1 year ago
Dear Tung Bach Nguyen Le,
By checking your code, I suspect this might be due to the fact that your editor has still its part in memory.
So clearing the editor is not enough, you should close the part and create a new one before importing the updated text.
Suppose your editor package has a single 'Text' content part and your package is named contentPackage, this could be done by inserting following code block after editor clear and before editor import:
By checking your code, I suspect this might be due to the fact that your editor has still its part in memory.
So clearing the editor is not enough, you should close the part and create a new one before importing the updated text.
Suppose your editor package has a single 'Text' content part and your package is named contentPackage, this could be done by inserting following code block after editor clear and before editor import:
Tung Bach Nguyen Le
Hi, it is me from the "Line Break Detect" topic
After run what you told me, i got this error

but when i run it in debug mode, it seems to be finethis is my code:
can you help me with this?
Dear Tung Bach Nguyen Le,
By checking your code, I suspect this might be due to the fact that your editor has still its part in memory.
So clearing the editor is not enough, you should close the part and create a new one before importing the updated text.
Suppose your editor package has a single 'Text' content part and your package is named contentPackage, this could be done by inserting following code block after editor clear and before editor import:
Best regards,
Gwenaëlle
Gwenaelle @MyScript
Dear Tung Bach Nguyen Le,
By checking your code, I suspect this might be due to the fact that your editor has still its part in memory.
So clearing the editor is not enough, you should close the part and create a new one before importing the updated text.
Suppose your editor package has a single 'Text' content part and your package is named contentPackage, this could be done by inserting following code block after editor clear and before editor import:
Best regards,
Gwenaëlle