Android Question Media Store update

Rusty

Well-Known Member
Licensed User
Longtime User
I am renaming a .jpg file using the following code:
B4X:
Sub RenameFile(SrcDir As String, SrcFilename As String, DestDir As String, DestFilename As String, Replace As Boolean) As Boolean     'ignore warning
    Dim R As Reflector, NewObj As Object, New As String , Old As String
    If SrcFilename = Null Or DestFilename = Null Or SrcDir = Null Or DestDir = Null Then Return False
    If File.Exists(SrcDir, SrcFilename) And (Replace Or Not(File.Exists(DestDir, DestFilename))) Then
        New = File.Combine(DestDir, DestFilename)
        Old = File.Combine(SrcDir, SrcFilename)
        If Not(New = Old) Then
            NewObj = R.CreateObject2("java.io.File", Array As Object(New),Array As String("java.lang.String"))
            R.Target = R.CreateObject2("java.io.File", Array As Object(Old),Array As String("java.lang.String"))
            Return R.RunMethod4("renameTo", Array As Object(NewObj),Array As String("java.io.File"))
        End If
    End If
    Return False
End Sub

Using Informatix UltimateListView which uses his MediaBrowser lib, the filename of the file PRIOR to the rename does not refresh/change.
Is there a way to rename a file and have the media database get updated so that the next list of media reflects the changed name and not the old name?
Thanks,
Rusty
 
Top