Android Question check if a file excist and show the value

Ricardo Bunschoten

Active Member
Licensed User
Longtime User
I need some help with file checking and showing values

I am building a kodi installer for a friend

The installer downloads a file wich is unpacked to a folder

But now he wants to check if his installed version is older or the same as a updated version online

I created a version.txt online which holds a value and that value is showned in a label

Code: Copy
Sub check_Click
    hc.Initialize("hc")
                    req.InitializeGet("http://download.filmspeler.nl/x/Version.txt") '<--- Replace this with your info
                hc.Execute(req, 1)
            End Sub
######## Fetch Data ########

Sub hc_ResponseSuccess(Response As HttpResponse, TaskId As Int)

    Label5.Text = Response.GetString("UTF8")

  
End Sub

Sub hc_ResponseError(Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)

    Msgbox("Error in app: " & Response.GetString("UTF8"), "")
              
                Response.Release
              
                End Sub


This works fine but now i want also label that shows the installed version

I want to read the value from version.txt which is located in Android/data/org.xbmc.kodi/files/.kodi

And show that value of that txt file in a label

But if that files does not excist i want to create a empy version.txt in the location Android/data/org.xbmc.kodi/files/.kodi.

I am not sure how to do that.

Greetz

Rico
 
I need some help with file checking and showing values

I am building a kodi installer for a friend

The installer downloads a file wich is unpacked to a folder

But now he wants to check if his installed version is older or the same as a updated version online

I created a version.txt online which holds a value and that value is showned in a label

Code: Copy
Sub check_Click
    hc.Initialize("hc")
                    req.InitializeGet("http://download.filmspeler.nl/x/Version.txt") '<--- Replace this with your info
                hc.Execute(req, 1)
            End Sub
######## Fetch Data ########

Sub hc_ResponseSuccess(Response As HttpResponse, TaskId As Int)

    Label5.Text = Response.GetString("UTF8")


End Sub

Sub hc_ResponseError(Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)

    Msgbox("Error in app: " & Response.GetString("UTF8"), "")
           
                Response.Release
           
                End Sub


This works fine but now i want also label that shows the installed version

I want to read the value from version.txt which is located in Android/data/org.xbmc.kodi/files/.kodi

And show that value of that txt file in a label

But if that files does not excist i want to create a empy version.txt in the location Android/data/org.xbmc.kodi/files/.kodi.

I am not sure how to do that.

Greetz

Rico

Code: Copy
    If File.Exists("directory where file is", "file name") = False Then
        File.OpenOutput("directory where you want file", "file name", False)
    Else
        Dim version As String
        version = File.ReadString("directory where file is", "file name")
        label1.text = version
    End If

You can do something like this!

Good luck!
 
Upvote 0
Back
Top