Hi i developing an native java application where user can imput text and images on an HTMLEditor (is native by its use case).
I trying to create an HTMLEditor Cutom View but the file chooser ask me for a Form, any way to handle?
I trying to create an HTMLEditor Cutom View but the file chooser ask me for a Form, any way to handle?
B4X:
Private Sub AddImage
Try
Dim path, fileName, fullPath, imsgStr As String
Dim fc As FileChooser
fc.Initialize
fc.Title="Browse and select a file"
fc.SetExtensionFilter("Image", Array As String ("*.jpg", "*.png", "*.gif"))
fc.InitialFileName = ""
fullPath = fc.ShowOpen(mBase.Parent) '<- unknow how handdle this because must be Form
path = File.GetFileParent(fullPath)
fileName = File.GetName(fullPath)
'convert the image in base64
imsgStr = Base64EncodeDecodeImage.Base64ImageToString(path,fileName)
' Show it in HTMLeditor view
EnhancedView.HtmlText = EnhancedView.HtmlText & "<p><img src=""data:image/png;base64," & imsgStr & """/></p>"
Catch
LogError("Error trying to add an image on EnhancedHTMLView")
End Try
End Sub