Sub Globals
Public IME As IME
Public xui As XUI
Public kvs As KeyValueStore
Private txtName As BRB4XFloatTextField
Private txtSurname As BRB4XFloatTextField
Private lblFullName As Label
Public Name As String
Public Surname As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Mainpage")
kvs.Initialize(xui.DefaultFolder, "testingKVS.dat")
End Sub
Sub CreateFileProviderUri (Dir As String, FileName As String) As Object
Dim FileProvider As JavaObject
Dim context As JavaObject
context.InitializeContext
FileProvider.InitializeStatic("android.support.v4.content.FileProvider")
Dim f As JavaObject
f.InitializeNewInstance("java.io.File", Array(Dir, FileName))
Return FileProvider.RunMethod("getUriForFile", Array(context, Application.PackageName & ".provider", f))
End Sub
Public Sub Save_to_KVS
IME.HideKeyboard
' kvs.DeleteAll
Name = txtName.Text
Surname = txtSurname.Text
kvs.Put("Name", Name)
kvs.Put("Surname", Surname)
Log("Original Name = " & Name)
Log("Original Surname = " & Surname)
lblFullName.Text = Name &" "& Surname
End Sub
Private Sub btnSave_Click
Dim FilesList As List
FilesList = File.ListFiles(Starter.shared)
Log("FileList = " & FilesList)
Save_to_KVS
'copy the file to the shared folder
' File.Copy(File.DirAssets, "b4a.png", Starter.shared, "b4a.png")
File.Copy(File.DirInternal, "testingKVS.dat", Starter.shared, "testingKVS.dat")
Dim in As Intent
' in.Initialize(in.ACTION_SEND, CreateFileProviderUri(Starter.shared, "b4a.png"))
in.Initialize(in.ACTION_SEND, CreateFileProviderUri(Starter.shared, "testingKVS.dat"))
in.Flags = 1
StartActivity(in)
End Sub