Hi,
I have make this example to work: https://www.b4x.com/android/forum/threads/get-file-from-email-attachment.54224/#post-340537
This is pretty smart
In thread #3 there is this code:
And in the line :
I can exchange myFolder with "File.DirInternal" go get the file in my internal dir.
But how do I get the original filename from the E-Mail?
Mogens
I have make this example to work: https://www.b4x.com/android/forum/threads/get-file-from-email-attachment.54224/#post-340537
This is pretty smart
In thread #3 there is this code:
B4X:
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(myFolder, myFile, False)
File.copy2(Inp, Out)
Inp.Close
Out.Close
End if
And in the line :
B4X:
Dim Out As OutputStream = File.OpenOutput(myFolder, myFile, False)
I can exchange myFolder with "File.DirInternal" go get the file in my internal dir.
But how do I get the original filename from the E-Mail?
Mogens