Android Question Activity_PermissionResult problem

Fillmore

Member
Licensed User
Longtime User
Hi,

Always with my Writte/Read permission problems...

I tried to write to File.DirRootExternal like this : https://www.b4x.com/android/forum/threads/denied-permission-sdk-23.69226/#post-439306

It's impossible for me to add the Last sub (Activity_permissionResult).

The project is too big to be join... So I past the code...

It's drive me crazy...


Thank you if somebody have an idea !



B4X:
#Region  Project Attributes
    #ApplicationLabel: qrcoAss
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False

#End Region

#Region  Activity Attributes
    #FullScreen: true
    #IncludeTitle: false
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim SP As SoundPool
    Dim LoadId1,PlayId1,LoadId2,PlayId2,LoadId3,PlayId3,LoadId4,PlayId4,LoadId5,PlayId5,LoadId6,PlayId6 As Int
    
    Dim awake As PhoneWakeState
    
    Dim SensorsMap As Map
    
    Dim nomqr As String
    
    Private Theme_Value As Int
    '''''''''''''''''''''''''''''''''''''
    Private rp As RuntimePermissions
    
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

Private res As XmlLayoutBuilder
''''''''''''''''''''''''''''''''''''''''''''
    Dim sdcardEnabled As Boolean

'********************************************

Dim baliseencours As Int
    Dim messageQR As String

    Dim err As String
    Dim mask_pattern As Int
    
    Dim rsie As RSImageEffects
    Dim rsip As RSImageProcessing
    Dim b As Bitmap

    Private ImageView2 As ImageView

    Dim shape As String
    
    Dim bmp As Bitmap

    Dim nomfichier,nomchemin As String
    

'****************************************************




    

Dim sonda As Typeface
    
    
    
    
    
    


    




    Private Panelaccueil As Panel
    
        

    Dim latactu,longactu As Double
    Dim locationactu As Location
'    Dim description(20) As String
'    Dim numerobal(20) As String
    
    
    
    Private Panelgps As Panel
    Private Btngps As Button
    Private nbsat As Int
    Private Labelsat As Label
    Private Labelnbsat As Label
    Private heureactu As Long
    
Dim num(1000) As String
Dim description(1000) As String
Dim latitude(1000),longitude(1000) As Double
Dim numbalise As Int   
    

    
    
    
    
    
    Dim phv As PhoneVibrate
    
    
    Private Paneletat As Panel
    Private Btnrecbal As Button
    Private Lblattente As Label
    Dim tablist As Table
    Dim tablist2 As Table
    
    Private Pnlliste As Panel
    Private ToggleButton1 As ToggleButton
    Private Lblcase As Label
    Private Btnfile As Button

Dim savedir As String
Dim savefile As String
    
    Private Btncrebal As Button
    Private Btncrecrefixe As Button
    Private Btncrecrevar As Button
    Private Btncrelibre As Button
    Private pnlaccueil As Panel
    Private pnllistcsv As Panel
    Private btnouvrir As Button
    Private btnqrlist As Button
    Private Btnqrbal As Button
    Private Btnsauve As Button
    Private Pnlfichiers As Panel
    
    Dim balsel As Boolean = False
    
    
    Private Panelprinc As Panel
    Private Imgcible As B4XView
    
    Dim crebal As Boolean = False
    
    
    Private lbldecompte As Label
    
    Private Btnmain As Button
    Private Imgmain As B4XView
    
    
    Private Lblmain As Label
    
    
    Dim rx, ry As Float
    Dim rt As Float
    
    
    Dim BD As BetterDialogs
    
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("main")
    
    
    awake.KeepAlive(False)
    
    
    '''''''''''''''''''''''''''''''''''''''''''
sdcardEnabled = False
    
    
    
    
    If FirstTime Then
        SP.Initialize(3)
        LoadId1 = SP.Load(File.DirAssets, "bibip.wav")
        LoadId2 = SP.Load(File.DirAssets, "wash2.wav")
        LoadId3 = SP.Load(File.DirAssets, "wash.wav")
        LoadId4 = SP.Load(File.DirAssets, "clic.wav")
        LoadId5 = SP.Load(File.DirAssets, "sonar.wav")
        'LoadId6 = SP.Load(File.DirAssets, "tada.wav")
    End If
    
    
    
    Activity.loadlayout("1")
    Activity.LoadLayout("accueil")

'    SetTheme(res.GetResourceId("style", "android:style/Theme.Material"))

    rx=GetDeviceLayoutValues.Height/1280
    ry=GetDeviceLayoutValues.width/800
    rt = ry/GetDeviceLayoutValues.Scale
    
    sonda = Typeface.LoadFromAssets("clock.ttf")
    

    Starter.GPS1.Stop

    tablist.Initialize(Me,"tablist",4)
    
    
    tablist2.Initialize(Me,"tablist2",5)
    
    tablist.AddToActivity(Pnlliste,0dip,0dip,Pnlliste.Width,Pnlliste.Height-10%y)
    tablist2.AddToActivity(pnllistcsv,0dip,0dip,0dip,0dip)
    tablist.SetHeader(Array As String("No","Description","Lat.","Long."))
    tablist2.SetHeader(Array As String("Nat.","No","Description","Lat.","Long."))
    
    Pnlliste.Visible=False
    
'    tablist2.visible=False
    
    
    
    
    
    
    'Keep the order of the next 4 lines. CAMERA_BACK and CAMERA_FRONT will only contain correct values once qrcrv.BackFacingCamera and qrcrv.FrontFacingCamera has
    'been executed else they will have default values of -1



'Panelgps.width=100%x
'Panelgps.height=100%Y
'Panelgps.top=0%y
'Panelgps.left=0%x


'Panelgps.Visible=False
'Panelaccueil.Visible=True

    

If File.Exists( "/storage/emulated/0/Qrco/","") = False Then File.MakeDir(File.DirRootExternal, "/Qrco/")
If File.Exists( "/storage/emulated/0/Qrco/Tabs","") = False Then File.MakeDir(File.DirRootExternal, "/Qrco/Tabs/")

'**************************************Panneau accueil

pnlaccueil.Visible=True
pnlaccueil.Left=-110%x



'********Panneau état

Paneletat.Height=20%x
Paneletat.Width=100%x
Paneletat.Left=0%x
Paneletat.Top=100%y-21%x

Labelsat.Height = 8%y
Labelsat.Width=Labelsat.Height
Labelsat.Top=4%y'99%y-Labelsat.Height
Labelsat.Left=1%x


Labelnbsat.Typeface=sonda
Labelnbsat.Height = Labelsat.Height
Labelnbsat.Width=Labelsat.Height
Labelnbsat.Top=Labelsat.Top
Labelnbsat.Left=Labelsat.Left+Labelsat.Width
Labelnbsat.TextSize=Labelnbsat.Height/5

ToggleButton1.Top=Labelsat.Top
ToggleButton1.Height=Labelsat.Height



Paneletat.visible=True



pnlaccueil.SetLayoutAnimated(500,0%x,0%y,100%x,100%y)
Sleep(500)

Panelprinc.Visible=True
    Paneletat.Visible=True
    Pnlfichiers.Visible=True









    '******************************* Text size







    btnqrlist.TextSize=30*rt

    Btnqrbal.TextSize=30*rt

    Btnfile.TextSize=30*rt


    Btnsauve.TextSize=30*rt
    


    ToggleButton1.TextSize=30*rt




    Btnrecbal.TextSize=30*rt




    

    lbldecompte.TextSize=30*rt
    

    
    Btncrebal.TextSize=40*rt


    Btncrecrefixe.TextSize=40*rt

    
    Btncrecrevar.TextSize=40*rt

    
    Btncrelibre.TextSize=40*rt

    
    btnouvrir.TextSize=40*rt
    
    

    

    

'****************************** Panel Balise













    '***************************** Fin panel Balise


    
    
    

    
End Sub

Sub Activity_Resume
If Starter.GPS1.GPSEnabled = False Then
        ToastMessageShow("Please enable the GPS device.", True)
        StartActivity(Starter.GPS1.LocationSettingsIntent) 'Will open the relevant settings screen.
    Else
        Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
    End If
    
    '''''''''''''''''''''''''''''''''''''''''''''''''''
    If sdcardEnabled = False Then
        rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
    End If
    
    
End Sub

Sub Activity_PermissionResult (Permission As String, Result As Boolean)
    If Permission = Starter.rp.PERMISSION_ACCESS_FINE_LOCATION Then
        If Result Then CallSub(Starter, "StartGPS")
    End If
End Sub

Sub Activity_Pause (UserClosed As Boolean)
CallSub(Starter, "StopGPS")
End Sub






Public Sub GpsStatus (Satellites As List)
    Dim sb As StringBuilder
    nbsat=Satellites.Size
    If nbsat<3 Then
        Labelsat.TextColor=Colors.Red
        Else
            If nbsat>=3 And nbsat<7 Then
                Labelnbsat.TextColor=Colors.Yellow
                Else
                
            Labelnbsat.TextColor=Colors.Green
    End If
    End If
    
    Labelnbsat.Text=Satellites.Size
    
    
    sb.Initialize
    sb.Append("Satellites:").Append(CRLF)
    For i = 0 To Satellites.Size - 1
        Dim Satellite As GPSSatellite = Satellites.Get(i)
        sb.Append(CRLF).Append(Satellite.Prn).Append($" $1.2{Satellite.Snr}"$).Append(" ").Append(Satellite.UsedInFix)
        sb.Append(" ").Append($" $1.2{Satellite.Azimuth}"$).Append($" $1.2{Satellite.Elevation}"$)
    Next
'    lblSatellites.Text = sb.ToString
End Sub

Public Sub LocationChanged(Location1 As Location)
    
    
    
        
    
    locationactu=Location1
    
    
    heureactu=Location1.Time
    
    
    
    
    
'     Dim hour As Int '= DateTime.GetHour(heure)
'    Dim minute As Int '= DateTime.GetMinute(heure)
'    Dim second As Int '= DateTime.GetSecond(heure)
    
'    hour =  Floor(heure/1000/60/60)
        
'    minute = Floor((heure/1000/60) Mod 60)
    
    
'    second=Floor(heure/1000) Mod 60
    
'        Log(NumberFormat(hour,2,0) &":"& NumberFormat( minute,2,0) & " : " & NumberFormat(second,2,0))
    
'    If Labeltps.Visible=True Then
    
'        Labeltps.Text=(NumberFormat(hour,2,0) &":"& NumberFormat( minute,2,0) & ":" & NumberFormat(second,2,0))
    
'   
'    cmpt=cmpt+1
    
'
    
    
    'If cmptdist = -1 Then
    '    locationpre=locationdepart
    
    'cmptdist=cmptdist+1
    'End If
    
    '
    
'    cmptdist=cmptdist+1
    
    
    
    '

    
    
    

    
    
    
    
End Sub


    '
'

'

'

'

'


'

'

'

'

Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event

    clic_30
    
    If KeyCode = KeyCodes.KEYCODE_BACK Then
    
        
        
        If crebal=True Then
            
        'clic_30
    
        pnlaccueil.SetLayoutAnimated(500,0%x,0%y,100%x,100%y)
        crebal=False
        Return True
        
        Else
        
        
        
        
        Dim resulta As Int
        resulta = Msgbox2("Vous allez quitter l'application", "Attention !", "Ok", "", "Annuler", LoadBitmap(File.DirAssets, "attention.png"))
        If resulta = DialogResponse.Positive Then
    
    clic_30
            awake.ReleaseKeepAlive

 
            ExitApplication 'App is exitin
    
    Starter.GPS1.Stop
    
 End If
 

        If resulta = DialogResponse.NEGATIVE Then
    
    
                clic_30

 
            Return True
    
        End If
          End If
             End If
 
End Sub

Sub Btnrecbal_Click
    
    Dim numero As String
    Dim desc As String
    Dim ret As Int
    Dim et As EditText
    
    
    Dim dr As Int
    
    
    
    
    clic_30
    phv.vibrate(50)
    

    Imgcible.SetRotationAnimated(250,180)
    Sleep(250)
    Imgcible.SetRotationAnimated(250,0)
        
        
    
    Dim IP As BD_InputBoxParams
    IP.Initialize
    IP.Question = ""'"<I>Numéro ? </I>"
    IP.QuestionTextSize = 18
    IP.SpaceBetween = 4dip
    IP.InputTextSize = 24
    IP.InputType = IP.INPUT_TYPE_TEXT_WITH_CAPS
    IP.Gravity = Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL
    IP.ValidationCallback = "Input_Validation"
    IP.WithSuggestions = True
    
    
    
    
    If num(numbalise) = Null Then
        
    
        IP.Default = ""
    
    Else
        
        IP.Default =  num(numbalise)
    
    End If
    
        
    
    IP.Default =  num(numbalise)
    dr = BD.InputBox("Numéro de la balise :", IP, "OK", "Annuler", "",LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True) )
    Log("DR=" & dr)


    If dr = -3 Then Return
    
    
    num(numbalise)=IP.Answer

    
    '***********************************************
    
    
    
    
    

'   
'    ******************************************

    '-----------Description

    IP.Question = ""'"<I>Numéro ? </I>"
    IP.QuestionTextSize = 18
    IP.SpaceBetween = 4dip
    IP.InputTextSize = 24
    IP.InputType = IP.INPUT_TYPE_TEXT_WITH_CAPS
    IP.Gravity = Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL
    IP.ValidationCallback = "Input_Validation"
    IP.WithSuggestions = True
    
    
    
    
    If description(numbalise) = Null Then
        
    
        IP.Default = ""
    
    Else
        
        IP.Default =  description(numbalise)
            
    End If
    
        
    
    'IP.Default =  description(numbalise)
    dr = BD.InputBox("Description de la balise :", IP, "OK", "Annuler", "",LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True) )
    Log("DR=" & dr)


    If dr = -3 Then Return
    
    
    description(numbalise)=IP.Answer
    
    
    
    'Starter.GPS1.Start(0, 0)
    Msgbox("Placez-vous à l'endroit désiré et cliquez sur OK","Enregistrement balise")
    
    
    clic_30
    
    If nbsat<8 Then
        
        MsgboxAsync("Attendre au moins 10 satellites","")
        phv.vibrate(50)
        
        Return
    End If
    
    
    


'imgcible.BringToFront
lbldecompte.TextSize=100*rt
    lbldecompte.visible=True
    'lbldecompte.SetLayoutAnimated(1000,50%x,20%x+20%y,10%x,10%y)
    
    PlayId5=SP.Play(LoadId5,1,1,1,0,1)
    phv.vibrate(30)
    
    Imgcible.SetRotationAnimated(250,180)
    Sleep(250)
    Imgcible.SetRotationAnimated(250,0)
    Sleep(250)
    Imgcible.SetRotationAnimated(250,180)
    Sleep(250)
    Imgcible.SetRotationAnimated(250,0)
    Sleep(250)

    lbldecompte.Text="2"
'    lbldecompte.Left=30%x
'    lbldecompte.Width=40%x
'    lbldecompte.Top=20%y
'    lbldecompte.Height=lbldecompte.Width
'    lbldecompte.TextSize=lbldecompte.Height/5
'    lbldecompte.SetLayoutAnimated(1000,50%x,20%y+20%x,0%x,0%y)
    Imgcible.SetRotationAnimated(250,180)
    Sleep(250)
    Imgcible.SetRotationAnimated(250,0)
    Sleep(250)
    Imgcible.SetRotationAnimated(250,180)
    Sleep(250)
    Imgcible.SetRotationAnimated(250,0)
    Sleep(250)


    PlayId5=SP.Play(LoadId5,1,1,1,0,1)
    phv.vibrate(30)
    lbldecompte.Text="1"
'    lbldecompte.Left=30%x
'    lbldecompte.Width=40%x
'    lbldecompte.Top=20%y
'    lbldecompte.Height=lbldecompte.Width
'    lbldecompte.TextSize=lbldecompte.Height/5
'    lbldecompte.SetLayoutAnimated(1000,50%x,20%y+20%x,0%x,0%y)
    Imgcible.SetRotationAnimated(250,180)
    Sleep(250)
    Imgcible.SetRotationAnimated(250,0)
    Sleep(250)
    Imgcible.SetRotationAnimated(250,180)
    Sleep(250)
    Imgcible.SetRotationAnimated(250,0)
    Sleep(250)
    
    'lbldecompte.TextSize=lbldecompte.Height/7
    lbldecompte.Text="OK"
'    lbldecompte.Left=30%x
'    lbldecompte.Width=40%x
''    lbldecompte.Top=20%y
'    lbldecompte.Height=lbldecompte.Width
'    lbldecompte.TextSize=lbldecompte.Height/5
'    lbldecompte.SetLayoutAnimated(1000,50%x,20%y+20%x,0%x,0%y)
    Imgcible.SetRotationAnimated(250,180)
    Sleep(250)
    Imgcible.SetRotationAnimated(250,0)
    Sleep(250)
    Imgcible.SetRotationAnimated(250,180)
    Sleep(250)
    Imgcible.SetRotationAnimated(250,0)
    Sleep(250)
'   
'    lbldecompte.Text="3"
'    lbldecompte.Left=30%x
'    lbldecompte.Width=40%x
'    lbldecompte.Top=20%y
'    lbldecompte.Height=lbldecompte.Width
'    lbldecompte.TextSize=lbldecompte.Height/5
lbldecompte.Visible=False
        lbldecompte.Text="3"
    
    latitude(numbalise)=locationactu.Latitude
    longitude(numbalise)=locationactu.Longitude
    
    'Msgbox(num(numbalise)&","&description(numbalise)&","&locationactu.Latitude&", "&locationactu.Longitude,"Pos.")
    
    tablist.AddRow(Array As String(num(numbalise),description(numbalise),Round2(latitude(numbalise),3),Round2(longitude(numbalise),3)))
    
    num(numbalise)=num(numbalise).replace(";",",")
    description(numbalise)=description(numbalise).replace(";",",")
    
    tablist2.AddRow(Array As String("BAL",num(numbalise),description(numbalise),latitude(numbalise),longitude(numbalise)))
    
    tablist2.SaveTableToCSV(File.DirRootExternal,"/qrco/Tabs/temp.csv")
    
    
    
    
    Dim resul As Int
    resul = Msgbox2("Souhaitez-vous créer le Qrcode de cette balise ?", "Créer Qrcode ?", "Oui", "", "Non", LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True))
    If resul = DialogResponse.Positive Then
        
        
        
        
        shape = "s"
        mask_pattern = 3
        err = "H"
        messageQR ="BAL;"&num(numbalise)&";"&description(numbalise)&";"&latitude(numbalise)&";"&longitude(numbalise)
        
        nomqr="BAL-"&num(numbalise)&"-"&description(numbalise)
    
        nomqr=nomqr.Replace("?","-")
        nomqr=nomqr.Replace(":","-")
        nomqr=nomqr.Replace(Chr(34),"-")
        nomqr=nomqr.Replace("*"," fois ")
        nomqr=nomqr.Replace("|","-")
        nomqr=nomqr.Replace("/"," slash ")
        nomqr=nomqr.Replace("<"," inf. ")
        nomqr=nomqr.Replace(">"," sup. -")
        nomqr=nomqr.Replace("+"," et ")
        nomqr=nomqr.Replace("="," égale ")
        nomqr=nomqr.Replace("[","-")
        nomqr=nomqr.Replace("]","-")
        
        
    '    Msgbox(nomqr,nomqr)
        
        
        QRcode.Draw_QR_Code(messageQR,err,mask_pattern,Colors.White,Colors.Black,shape)
        
        
        ToastMessageShow(" Qr code pour Balise : "&num(numbalise)&"-"&description(numbalise)&" créé.",True)
        
        
        
    End If
    
    
    
    
    
    
    
    
    
    
    
    numbalise=numbalise+1
    
    'Starter.GPS1.Stop
    Labelnbsat.text=nbsat
    
End Sub

Sub Tablist_CellClick (Col As Int, Row As Int)
    Log("CellClick: " & Col & " , " & Row)
    clic_30
    phv.vibrate(50)
    
    
    balsel=True
    
    If Col=0 Then Lblcase.text= "Num. : " &num(Row)
    If Col=1 Then Lblcase.text= "Desc. : " &description(Row)
    If Col=2 Then Lblcase.text= "Lat. : "&latitude(Row)
    If Col=3 Then Lblcase.text= "Long. : "&longitude(Row)
    
    baliseencours=Row
    
    
End Sub


Sub ToggleButton1_CheckedChange(Checked As Boolean)
    
    If Pnlliste.Visible=False Then
        Pnlliste.Visible=True
        Btnqrbal.visible=True
        btnqrlist.Visible=True
        Btnfile.Visible=True
        Btnsauve.Visible=True
        PlayId2=SP.Play(LoadId2,1,1,1,0,1)
        
        Pnlliste.SetLayoutAnimated(300,0dip,0dip,100%x,60%y)
        Pnlfichiers.SetLayoutAnimated(300,0dip,62%y,100%x,21%y)
        Imgmain.SetLayoutAnimated(300,35%x,110%y,40%x,40%x)
        Btnmain.SetLayoutAnimated(300,35%x,115%y,30%x,30%x)
        Lblmain.setlayoutanimated(300,35%x,115%y,30%x,30%x)
        
        
        
        
        Else
        
        'Btnqrbal.visible=False
        'btnqrlist.Visible=False
        'Btnfile.Visible=False
        'Btnsauve.Visible=False
        PlayId3=SP.Play(LoadId3,1,1,1,0,1)
        Pnlliste.SetLayoutAnimated(300,0dip,-70%y,100%x,60%y)
        Pnlfichiers.SetLayoutAnimated(300,0dip,110%y,100%x,21%y)
        Btnmain.SetLayoutAnimated(300,30%x,30%y+40%x,40%x,40%x)
        Lblmain.SetLayoutAnimated(300,30%x,30%y+40%x,40%x,40%x)
        Imgmain.SetLayoutAnimated(300,35%x,30%y+45%x,30%x,30%x)
        Sleep(300)
        Pnlliste.Visible=False
        
    End If
    
End Sub

Sub btnFile_Click 'Sauver sous
    Dim ret As Int
    
    'Dim Id As InputDialog
    'Dim nomfile As String
        
    'Id.Input=DateTime.GetDayOfMonth(DateTime.Now)&"-"&DateTime.GetMonth(DateTime.Now)&"-"&DateTime.GetYear(DateTime.Now)&"-"&DateTime.GetHour(DateTime.Now)&"-"&DateTime.GetMinute(DateTime.Now)&"-"&DateTime.GetSecond(DateTime.Now)
    
    
    
    'Id.Hint = "Nom de fichier ?"
    'Id.HintColor = Colors.ARGB(196, 255, 140, 0)
    
'    ret = Id.Show("Nom du Fichier ?", "", "OK", "Annuler", "", LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True))
'    If ret = -3 Then Return
    
'    nomfile=Id.Input
'    savefile=nomfile
    
    clic_30
    phv.vibrate(30)
    
    
    
    Dim fd As FileDialog
    fd.FastScroll = True
    fd.ShowOnlyFolders = False
    'fd.ChosenName="blabla"
    fd.FilePath = File.DirRootExternal&"/qrco/Tabs/" ' also sets ChosenName to an emtpy string

    fd.ChosenName=nomfichier&".csv"

    'fd.ShowOnlyFolders = true
    'fd.FileFilter = ".txt" ' for example or ".jpg,.png" for multiple file types
    ret = fd.Show("B4A File Dialog", "Sauver", "Retour", "",  LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True))
    
    If fd.ChosenName="" Then
        
        Msgbox("Nom de fichier ?","Erreur nom")
        ret=0
        
        
        fd.FastScroll = True
        fd.ShowOnlyFolders = False
        'fd.ChosenName="blabla"
        fd.FilePath = File.DirRootExternal&"/qrco/Tabs/" ' also sets ChosenName to an emtpy string

        fd.ChosenName=nomfichier&".csv"
        
        ret = fd.Show("B4A File Dialog", "Sauver", "Retour", "",  LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True))
        
        
        
    End If
    
    
    If ret=-1 Then
        clic_30
    savedir=fd.FilePath
    'ToastMessageShow(ret & " : Path : " & fd.FilePath & CRLF & "File : " & nomfile, False)
    ToastMessageShow(ret & " : Path : " & savedir & CRLF & "File : " & fd.ChosenName, False)
    
    fd.ChosenName=fd.ChosenName.Replace(".csv","")
    
    
    nomfichier = fd.ChosenName
    nomchemin=fd.FilePath
    'Dim tablist2 As List
    'Dim ru As StringUtils
    'Dim head As List
    'head.Initialize2(Array As String("Numéro","Description","Latitude","Longitude"))
    
    
    'tablist2.SaveTableToCSV(File.DirRootExternal,"/Qrco/Tabs/"&nomfichier&".csv")
    tablist2.SaveTableToCSV(nomchemin,nomfichier&".csv")
    Btnsauve.Text="Sauvegarder '"&nomfichier&".csv'"
    
    ''Initialise la list
    'for 0 to longueur de tablist
    'ajoute BAL,num,descript...
    
    
    
    
    'ru.SaveCSV2(File.DirRootExternal,"list.csv",";",tablist2,Array("Type", "Num.", "Descript.", "Lat.", "Long."))
    End If
    
    If ret=-3 Then
        clic_30
        Return
    End If
    
    
End Sub

Sub Btncrelibre_Click
    clic_30
    phv.vibrate(30)
    Dim chaine As String
    Dim ret As Int
    
    Dim Id As InputDialog
        
    Id.Input = ""
    
    
    
    Id.Hint = "Chaine de caractères ?"
    Id.HintColor = Colors.ARGB(196, 255, 140, 0)
    
    ret = Id.Show("Chaine ?", "", "OK", "Annuler", "", LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True))
    If ret = -3 Then
        clic_30
        phv.vibrate(30)
        Return
    End If
    
    clic_30
    phv.vibrate(30)
    chaine=Id.Input
    
    '***************** Crée qr
    
    shape = "s"
    mask_pattern = 3
    err = "H"
    messageQR =chaine
    nomqr=chaine
    
    nomqr=nomqr.Replace("?","-")
    nomqr=nomqr.Replace(":","-")
    nomqr=nomqr.Replace(Chr(34),"-")
    nomqr=nomqr.Replace("*"," fois ")
    nomqr=nomqr.Replace("|","-")
    nomqr=nomqr.Replace("/"," slash ")
    nomqr=nomqr.Replace("<"," inf. ")
    nomqr=nomqr.Replace(">"," sup. -")
    nomqr=nomqr.Replace("+"," et ")
    nomqr=nomqr.Replace("="," égale ")
    nomqr=nomqr.Replace("[","-")
    nomqr=nomqr.Replace("]","-")
        
        
    'Msgbox(nomqr,nomqr)
        
        
    QRcode.Draw_QR_Code(messageQR,err,mask_pattern,Colors.White,Colors.Black,shape)
        
        
    ToastMessageShow("Chaine libre : "&chaine&" créée.",True)
    
    
    
End Sub

Sub Btncrecrevar_Click
    clic_30
    phv.vibrate(30)
    Dim credit As Int
    Dim ret As Int
    
    Dim Id As InputDialog
    Dim et As EditText
    Id.InputType=et.INPUT_TYPE_NUMBERS   
        Id.Input = ""
    
    
    
    Id.Hint = "Nombre de crédit par balise ?"
    Id.HintColor = Colors.ARGB(196, 255, 140, 0)
    
    ret = Id.Show("Crédit ?", "", "OK", "Annuler", "", LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True))
    If ret = -3 Then
        clic_30
        phv.vibrate(30)
        Return
    End If
    
    
    clic_30
    phv.vibrate(30)
    credit=Id.Input
    
    '***************** Crée qr
    
    shape = "s"
    mask_pattern = 3
    err = "H"
    messageQR ="CREX;"&credit
    nomqr="CREX-"&credit
    
    nomqr=nomqr.Replace("?","-")
    nomqr=nomqr.Replace(":","-")
    nomqr=nomqr.Replace(Chr(34),"-")
    nomqr=nomqr.Replace("*"," fois ")
    nomqr=nomqr.Replace("|","-")
    nomqr=nomqr.Replace("/"," slash ")
    nomqr=nomqr.Replace("<"," inf. ")
    nomqr=nomqr.Replace(">"," sup. -")
    nomqr=nomqr.Replace("+"," et ")
    nomqr=nomqr.Replace("="," égale ")
    nomqr=nomqr.Replace("[","-")
    nomqr=nomqr.Replace("]","-")
        
        
    'Msgbox(nomqr,nomqr)
        
        
    QRcode.Draw_QR_Code(messageQR,err,mask_pattern,Colors.White,Colors.Black,shape)
        
        
    ToastMessageShow(" Credit variable X "&credit&" créé.",True)
    
    
    
End Sub

Sub Btncrecrefixe_Click
    
    
    clic_30
    phv.vibrate(30)
    
    Dim credit As Int
    Dim ret As Int
    
    Dim Id As InputDialog
    
    Dim et As EditText
    Id.InputType=et.INPUT_TYPE_NUMBERS
        
    Id.Input = ""
    
    
    
    Id.Hint = "Crédit total ?"
    Id.HintColor = Colors.ARGB(196, 255, 140, 0)
    
    ret = Id.Show("Crédit ?", "", "OK", "Annuler", "", LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True))

    If ret = -3 Then
        clic_30
        phv.vibrate(30)
        Return   
    End If
        
    
    clic_30
    phv.vibrate(30)
    
    credit=Id.Input
    
    '***************** Crée qr
    
    shape = "s"
    mask_pattern = 3
    err = "H"
    messageQR ="CRE;"&credit
    nomqr="CRE-"&credit
    
    nomqr=nomqr.Replace("?","-")
    nomqr=nomqr.Replace(":","-")
    nomqr=nomqr.Replace(Chr(34),"-")
    nomqr=nomqr.Replace("*"," fois ")
    nomqr=nomqr.Replace("|","-")
    nomqr=nomqr.Replace("/"," slash ")
    nomqr=nomqr.Replace("<"," inf. ")
    nomqr=nomqr.Replace(">"," sup. -")
    nomqr=nomqr.Replace("+"," et ")
    nomqr=nomqr.Replace("="," égale ")
    nomqr=nomqr.Replace("[","-")
    nomqr=nomqr.Replace("]","-")
        
        
'    Msgbox(nomqr,nomqr)
        
        
    QRcode.Draw_QR_Code(messageQR,err,mask_pattern,Colors.White,Colors.Black,shape)
        
        
    ToastMessageShow(" Credit fixe "&credit&" créé.",True)
    
End Sub

Sub Btncrebal_Click
    
    clic_30
    
    pnlaccueil.SetLayoutAnimated(500,-110%x,0%y,100%x,100%y)
    crebal=True
    
End Sub

Sub btnouvrir_Click
    
    clic_30
    
    
    Dim ret As Int
    Dim fd As FileDialog
    fd.FastScroll = True
    fd.ShowOnlyFolders = False
    
    fd.FilePath = File.DirRootExternal&"/qrco/Tabs/" ' also sets ChosenName to an emtpy string

    'fd.ShowOnlyFolders = true
    'fd.FileFilter = ".txt" ' for example or ".jpg,.png" for multiple file types
    ret = fd.Show("B4A File Dialog", "Ouvrir", "Retour", "",  LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True))
    
    If ret=-1 Then
    
        clic_30
        
    
    If fd.ChosenName="" Then
        Msgbox("Vous devez choisir un fichier !","Erreur !")
        Return
        End If
    
    savedir=fd.FilePath
    nomchemin=fd.FilePath
    'ToastMessageShow(ret & " : Path : " & fd.FilePath & CRLF & "File : " & nomfile, False)
    'ToastMessageShow(ret & " : Path : " & savedir & CRLF & "File : " & fd.ChosenName, False)
    
    pnlaccueil.SetLayoutAnimated(500,-110%x,0%y,100%x,100%y)
    
        crebal=True
    'Dim tablist2 As List
    'Dim ru As StringUtils
    'Dim head As List
    'head.Initialize2(Array As String("Numéro","Description","Latitude","Longitude"))
    
    tablist2.ClearAll
    tablist.ClearAll
    tablist2.LoadTableFromCSV(File.DirRootExternal,"/Qrco/Tabs/"&fd.ChosenName,True)
    nomfichier=fd.ChosenName.Replace(".csv","")
    
    numbalise=0
    ToastMessageShow(tablist2.Size,True)
    For t=0 To tablist2.Size-1
        
        num(numbalise)=tablist2.GetValue(1,t)
        description(numbalise)=tablist2.GetValue(2,t)
        latitude(numbalise)=tablist2.GetValue(3,t)
        longitude(numbalise)=tablist2.GetValue(4,t)
        
        tablist.AddRow(Array As String(num(numbalise),description(numbalise),Round2(latitude(numbalise),3),Round2(longitude(numbalise),3)))
        numbalise=numbalise+1
        
            
        
    Next
    
    Btnsauve.Text="Sauvegarder '"&nomfichier&".csv'"
    
    Else
        clic_30
        
        Return
    
    End If
    
    
    
        
End Sub

Sub qrtable
    
    shape = "s"
    mask_pattern = 3
    err = "H"
    
    
    For t=0 To tablist2.Size - 1
    
    messageQR ="BAL;"&num(t)&";"&description(t)&";"&latitude(t)&";"&longitude(t)
    nomqr="BAL-"&num(t)&"-"&description(t)
    
    nomqr=nomqr.Replace("?","-")
    nomqr=nomqr.Replace(":","-")
    nomqr=nomqr.Replace(Chr(34),"-")
    nomqr=nomqr.Replace("*"," fois ")
    nomqr=nomqr.Replace("|","-")
    nomqr=nomqr.Replace("/"," slash ")
    nomqr=nomqr.Replace("<"," inf. ")
    nomqr=nomqr.Replace(">"," sup. -")
    nomqr=nomqr.Replace("+"," et ")
    nomqr=nomqr.Replace("="," égale ")
    nomqr=nomqr.Replace("[","-")
    nomqr=nomqr.Replace("]","-")
        
        
    
        
        
    QRcode.Draw_QR_Code(messageQR,err,mask_pattern,Colors.White,Colors.Black,shape)
        
    Next
        
    ToastMessageShow(" Qr code(s) pour "& tablist2.Size&" Balise(s) créé(s).",True)


End Sub

Sub btnqrlist_Click
    
    
    If tablist2.Size=0 Then
        clic_70
        Dim result As Int
        result = Msgbox2("La liste est vide.", "Attention", "Ok", "", "", LoadBitmap(File.DirAssets, "attention.png"))
        If result = DialogResponse.Positive Then
        
            clic_30
        
            Return
        End If
        
    End If
    
    
    
    clic_30
    phv.vibrate(50)
    Dim resulta As Int
    resulta = Msgbox2("Vous allez créer tous les QrCodes relatifs à cette liste.", "Attention !", "Ok", "", "Annuler", LoadBitmap(File.DirAssets, "attention.png"))
    If resulta = DialogResponse.Positive Then
    
    
        
        clic_30
 
        
    
        qrtable
    
    End If
 

    If resulta = DialogResponse.NEGATIVE Then
    
    clic_30
                

 
        Return True
    
    End If
    
    
    
    
    
    
    
    
    
    
    
    
    
End Sub

Sub Btnqrbal_Click
    
    
    
    
    If balsel=False Then
        clic_70
        Dim result As Int
        result = Msgbox2("Vous n'avez pas sélectionné de balise", "Attention", "Ok", "", "", LoadBitmap(File.DirAssets, "attention.png"))
        If result = DialogResponse.Positive Then
        
        
        clic_30
        Return
        End If
        
    End If
    
    clic_30
    Dim resulta As Int
    resulta = Msgbox2("Vous allez créer le Qrcode relatif à la balise "&num(baliseencours), "Attention !", "Ok", "", "Annuler", LoadBitmap(File.DirAssets, "attention.png"))
    If resulta = DialogResponse.Positive Then
    
        clic_30
        

        shape = "s"
        mask_pattern = 3
        err = "H"
        messageQR ="BAL;"&num(baliseencours)&";"&description(baliseencours)&";"&latitude(baliseencours)&";"&longitude(baliseencours)
        nomqr="BAL-"&num(baliseencours)&"-"&description(baliseencours)
    
        nomqr=nomqr.Replace("?","-")
        nomqr=nomqr.Replace(":","-")
        nomqr=nomqr.Replace(Chr(34),"-")
        nomqr=nomqr.Replace("*"," fois ")
        nomqr=nomqr.Replace("|","-")
        nomqr=nomqr.Replace("/"," slash ")
        nomqr=nomqr.Replace("<"," inf. ")
        nomqr=nomqr.Replace(">"," sup. -")
        nomqr=nomqr.Replace("+"," et ")
        nomqr=nomqr.Replace("="," égale ")
        nomqr=nomqr.Replace("[","-")
        nomqr=nomqr.Replace("]","-")
        
        
        'Msgbox(nomqr,nomqr)
        
        
        QRcode.Draw_QR_Code(messageQR,err,mask_pattern,Colors.White,Colors.Black,shape)
        
        
        ToastMessageShow(" Qr code pour Balise : "&num(baliseencours)&"-"&description(baliseencours)&" créé.",True)
 
        
    
        
    
    End If
 

    If resulta = DialogResponse.NEGATIVE Then
    
    
                clic_30

 
        Return True
    
    End If
    
    
    
    
    
    
    
    
    
    
End Sub

Sub Btnsauve_Click 'sauvegarder
    
    
    clic_30
    
    
    If nomfichier="" Then
         btnFile_Click
        
         Else
        
        tablist2.SaveTableToCSV(nomchemin,nomfichier&".csv")
        
        
        
        
        ToastMessageShow(" : Path : " & savedir & CRLF & "File : " & nomfichier&".csv", False)
            
    End If
    
End Sub

Sub clic_30
    
    PlayId4=SP.Play(LoadId4,1,1,1,0,1)
    phv.vibrate(30)
    
    
End Sub

Sub clic_70
    
    PlayId4=SP.Play(LoadId4,1,1,1,0,1)
    phv.vibrate(30)
    Sleep(40)
    phv.vibrate(90)
    
    
End Sub


Sub Btnmain_Click
    
    clic_30
    
    Imgmain.SetRotationAnimated(150,-30)
    Sleep(150)
    Imgmain.SetRotationAnimated(150,0)
    Sleep(150)
    
    Dim et As EditText
    Dim ret As Int
    
    Dim DR As Int
    
    '************************************
    
    
    
    
    Dim IP As BD_InputBoxParams
    IP.Initialize
    IP.Question = ""'"<I>Numéro ? </I>"
    IP.QuestionTextSize = 18
    IP.SpaceBetween = 4dip
    IP.InputTextSize = 24
    IP.InputType = IP.INPUT_TYPE_TEXT_WITH_CAPS
    IP.Gravity = Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL
    IP.ValidationCallback = "Input_Validation"
    IP.WithSuggestions = True
    
    
    
    
    If num(numbalise) = Null Then
        
    
        IP.Default = ""
    
    Else
        
        IP.Default =  num(numbalise)
    
    End If
    
        
    
    IP.Default =  num(numbalise)
    DR = BD.InputBox("Numéro de la balise :", IP, "OK", "Annuler", "",LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True) )
    Log("DR=" & DR)


    If DR = -3 Then Return
    
    
    num(numbalise)=IP.Answer

    
    '***********************************************
    
    
    
    
    
    
    
    
    
    
    
    
'    Dim Id As InputDialog
'    If num(numbalise) = Null Then
'       
'   
'        Id.Input = ""
'   
'    Else
'       
'        Id.Input=num(numbalise)
'   
'    End If
'   
'    Id.Hint = "Numéro de la balise"
'    Id.HintColor = Colors.ARGB(196, 255, 140, 0)
'    Id.InputType=et.INPUT_TYPE_TEXT
'   
'    ret = Id.Show("", "Numéro de la Balise :", "OK", "Annuler", "", LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True))
'    If ret = -3 Then Return
'   
'    num(numbalise)=Id.Input
'   
'    ******************************************

'-----------Description

    IP.Question = ""'"<I>Numéro ? </I>"
    IP.QuestionTextSize = 18
    IP.SpaceBetween = 4dip
    IP.InputTextSize = 24
    IP.InputType = IP.INPUT_TYPE_TEXT_WITH_CAPS
    IP.Gravity = Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL
    IP.ValidationCallback = "Input_Validation"
    IP.WithSuggestions = True
    
    
    
    
    If description(numbalise) = Null Then
        
    
        IP.Default = ""
    
    Else
        
        IP.Default =  description(numbalise)
            
    End If
    
        
    
    'IP.Default =  description(numbalise)
    DR = BD.InputBox("Description de la balise :", IP, "OK", "Annuler", "",LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True) )
    Log("DR=" & DR)


    If DR = -3 Then Return
    
    
    description(numbalise)=IP.Answer
    


'    *******************************************
'    Dim Id2 As InputDialog
    
        
'    Id2.Input=description(numbalise)
    
    
    
    
    
    'Id2.Input = ""
'    Id2.Hint = "Description"
'    Id2.HintColor = Colors.ARGB(196, 255, 140, 0)
'    Id2.InputType=et.INPUT_TYPE_TEXT
'    ret = Id2.Show("", "Description :", "OK", "Annuler", "", LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True) )
'    If ret = -3 Then Return
'   
'    description(numbalise)=Id2.Input
'   
'    'LATITUDE**********************


    '*********************************************
    Dim textremp As String

    IP.Question = ""'"<I>Numéro ? </I>"
    IP.QuestionTextSize = 18
    IP.SpaceBetween = 4dip
    IP.InputTextSize = 24
    IP.InputType = IP.INPUT_TYPE_DECIMAL_NUMBERS
    IP.Gravity = Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL
    IP.ValidationCallback = "Input_Validation"
    IP.WithSuggestions = True
    
    If longitude(numbalise)<>0 Then
        textremp=latitude(numbalise)
    Else
        textremp=""
        
    End If
    IP.Default=textremp
        
    
    'IP.Default =  description(numbalise)
    DR = BD.InputBox("Latitude :", IP, "OK", "Annuler", "",LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True) )
    Log("DR=" & DR)


    If DR = -3 Then Return
    
    
latitude(numbalise)=IP.Answer





'**********************************************











'    Dim Id3 As InputDialog
'    Dim textremp As String
'    If latitude(numbalise)<>0 Then
'        textremp=latitude(numbalise)
'        Else
'            textremp=""
'       
'    End If   
'    Id3.Input=textremp
'   
'    Id3.Hint = "Latitude"
'    Id3.HintColor = Colors.ARGB(196, 255, 140, 0)
'    Id3.InputType=et.INPUT_TYPE_DECIMAL_NUMBERS
'   
'   
'    ret = Id3.Show("", "Entrez la Latitude :", "OK", "Annuler", "", LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True) )
'    If ret = -3 Then Return
'   
'    latitude(numbalise)=Id3.Input
    
    
    'LONGITUDE*************************************
    
    
    IP.Question = ""'"<I>Numéro ? </I>"
    IP.QuestionTextSize = 18
    IP.SpaceBetween = 4dip
    IP.InputTextSize = 24
    IP.InputType = IP.INPUT_TYPE_DECIMAL_NUMBERS
    IP.Gravity = Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL
    IP.ValidationCallback = "Input_Validation"
    IP.WithSuggestions = True
    
    If longitude(numbalise)<>0 Then
        textremp=longitude(numbalise)
    Else
        textremp=""
        
    End If
    IP.Default=textremp
        
    
    'IP.Default =  description(numbalise)
    DR = BD.InputBox("Longitide de la balise :", IP, "OK", "Annuler", "",LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True) )
    Log("DR=" & DR)


    If DR = -3 Then Return
    
    
    longitude(numbalise)=IP.Answer
    
    
    
    
    
    
    
    
    '*************************************************
    
    
    
    
'        Dim Id4 As InputDialog
'    If longitude(numbalise)<>0 Then
'        textremp=latitude(numbalise)
'    Else
'        textremp=""
'       
'    End If
'    Id4.Input=textremp
'   
'    Id4.Hint = "Longitude"
'    Id4.HintColor = Colors.ARGB(196, 255, 140, 0)
'    Id4.InputType=et.INPUT_TYPE_DECIMAL_NUMBERS
'   
'   
'   
'    ret = Id4.Show("", "Entrez la Longitude :", "OK", "Annuler", "", LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True) )
'    If ret = -3 Then Return
'   
'    longitude(numbalise)=Id4.Input

    
    
    
    'Msgbox(num(numbalise)&","&description(numbalise)&","&latitude(numbalise)&", "&longitude(numbalise),"Pos.")
    
    tablist.AddRow(Array As String(num(numbalise),description(numbalise),Round2(latitude(numbalise),3),Round2(longitude(numbalise),3)))
    
    num(numbalise)=num(numbalise).replace(";",",")
    description(numbalise)=description(numbalise).replace(";",",")
    
    tablist2.AddRow(Array As String("BAL",num(numbalise),description(numbalise),latitude(numbalise),longitude(numbalise)))
    
    tablist2.SaveTableToCSV(File.DirRootExternal,"/qrco/Tabs/temp.csv")
    
    
    
    
    Dim resul As Int
    resul = Msgbox2("Souhaitez-vous créer le Qrcode de cette balise ?", "Créer Qrcode ?", "Oui", "", "Non", LoadBitmapResize(File.DirAssets, "cible4.png",7%x,7%x,True))
    If resul = DialogResponse.Positive Then
        
        
        
        
        shape = "s"
        mask_pattern = 3
        err = "H"
        messageQR ="BAL;"&num(numbalise)&";"&description(numbalise)&";"&latitude(numbalise)&";"&longitude(numbalise)
        
        nomqr="BAL-"&num(numbalise)&"-"&description(numbalise)
    
        nomqr=nomqr.Replace("?","-")
        nomqr=nomqr.Replace(":","-")
        nomqr=nomqr.Replace(Chr(34),"-")
        nomqr=nomqr.Replace("*"," fois ")
        nomqr=nomqr.Replace("|","-")
        nomqr=nomqr.Replace("/"," slash ")
        nomqr=nomqr.Replace("<"," inf. ")
        nomqr=nomqr.Replace(">"," sup. -")
        nomqr=nomqr.Replace("+"," et ")
        nomqr=nomqr.Replace("="," égale ")
        nomqr=nomqr.Replace("[","-")
        nomqr=nomqr.Replace("]","-")
        
        
        Msgbox(nomqr,nomqr)
        
        
        QRcode.Draw_QR_Code(messageQR,err,mask_pattern,Colors.White,Colors.Black,shape)
        
        
        ToastMessageShow(" Qr code pour Balise : "&num(numbalise)&"-"&description(numbalise)&" créé.",True)
        
        
        
    End If
    
    
    
    
    
    
    
    
    
    
    
    numbalise=numbalise+1
    
    'Starter.GPS1.Stop
    'Labelnbsat.text=nbsat
    
    
End Sub



Private Sub SetTheme (Theme As Int)
    If Theme = 0 Then
        ToastMessageShow("Theme not available.", False)
        Return
    End If
    If Theme = Theme_Value Then Return
    Theme_Value = Theme
    Activity.Finish
    StartActivity(Me)
End Sub

Sub Activity_PermissionResult (Permission As String, Result As Boolean)

  If Permission = rp.PERMISSION_WRITE_EXTERNAL_STORAGE Then
        sdcardEnabled = False
        Log("You NOW can write to File.DirRootExternal")       
         File.WriteString(File.DirRootExternal, "/QRCO/String.txt", _
        "This is some string" & CRLF & "and this is another one.")
  End If

end sub
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
If File.Exists( "/storage/emulated/0/Qrco/","") = False Then File.MakeDir(File.DirRootExternal, "/Qrco/")
If File.Exists( "/storage/emulated/0/Qrco/Tabs","") = False Then File.MakeDir(File.DirRootExternal, "/Qrco/Tabs/")
this is in activity create. But at this point you do not have permission.

Go over the runtimepermissions tutorial again. As often untill you understand how it works.
 
Upvote 0
Top