Product: Android Native SDK
Product Version: 9.2.3
Please give a brief summary of your issue:
After editing a field in a fillable pdf cannot grab edited info without unfocusing from field.
Please describe your issue and provide steps to reproduce it:
Currently I’m using the ToolManager.AnnotationModificationListener
’s onAnnotationsModified
function to get the xfdf string of the field after edited. I’m storing an array of fields edited and when save is clicked I send the array to the backend to save.
override fun onAnnotationsModified(
annots: MutableMap<Annot, Int>?,
extra: Bundle?
) {
try {
annots?.forEach {
val annot = it.key
if (annot.type == Annot.e_Widget) {
val w = Widget(annot)
val field = w.field
if (field != null && field.isValid) {
val xfdfString = pdfViewCtrlTabHostFragment?.currentPdfViewCtrlFragment?.pdfDoc?.fdfExtract(arrayListOf(annot))?.saveAsXFDF()
val name = field.name
// Remove previous edit if in there.
if (editedFields.containsKey(name)) {
editedFields.remove(name)
}
editedFields[name] = PDFField(
id = name,
xfdfString = xfdfString
)
}
}
}
} catch (e: PDFNetException) {
e.printStackTrace()
} catch (e: IOException) {
e.printStackTrace()
}
}
I’ve noticed that my code above using onAnnotationsModified
callback is only called when the edited field is unfocused. Because of this when hitting the “save” button, the last edited field is not included in the array being sent to the backend. when the user doesn’t first tap outside the field.
How can I grab the updated xfdf value of the edited field if never unfocused before tapping the save button?