Sub Activity_Click
Translate("ניסיון אחד שניים שלוש", "he", "en")
End Sub
Sub Translate(Text As String, SourceLanguage As String, TargetLanguage As String)
Dim i As Intent
i.Initialize(i.ACTION_VIEW, $"http://translate.google.com/m/translate?q=${Text}&sl=${SourceLanguage}&tl=${TargetLanguage}"$)
Dim jo As JavaObject = i
jo.RunMethod("setPackage", Array("com.google.android.apps.translate"))
Try
StartActivity(i)
Catch
Log(LastException)
End Try
End Sub
Thank you very much, Erel.
It works even offline, provided the user has installed the right language package.
BUT the google page stays open, even if I click on the 'copy' button. No way to return to my app.
Would it be possible to launch it in a webView or send it keystroke to disappear?
john m.
I can start the off-line google translator all right, but to use the translated text in my app, the user has to click on the "copy" button and then several times on the back button on the device.
Is there a better way, e.g. getting the app to close itself once the "copy" button has been pressed?
john m.