Dim Intent1 As Intent
Intent1 = Activity.GetStartingIntent
If Intent1.Action = "android.intent.action.VIEW" Then ' The activity has been called from outside the app
Dim jo As JavaObject
Dim cd As String = jo.InitializeStatic("anywheresoftware.b4a.objects.streams.File").GetField("ContentDir")
Dim UriString As String = Intent1.GetData
Dim Inp As InputStream = File.OpenInput(cd , UriString)
Dim Out As OutputStream = File.OpenOutput(File.DirInternal, "emailtransfer.txt", False)
File.copy2(Inp, Out)
Inp.Close
Out.Close