Can Close

mtw

Member
Licensed User
Longtime User
Are you going to implement a can close routine, I see the Activity_Pause (UserClosed) but app still exits setting UserClosed to false.

ie: when you hit the close, (back to previous page), return etc button
To keep it from closing, so you can go to a previous page instead of closing


IsDirectory when called in root directory "/" always returns false.
 
Last edited:

mtw

Member
Licensed User
Longtime User
I should have worded the question better, are you going to implement an "Is app closing" and have a "can close" event that you can set to let the program know it's closing but to stop it from closing ie "a file is open" etc

Also I have a typed array with Listview as one of the members in the typed variable, so in the same as the above question,

Type MyListViewArray (LV As ListView, name As String, Path_ As String, Count As Int)

Dim lv(25) as MyListViewArray

everything works fine, but a callback procedure on a activity closing would be needed, and to be able to assign an OnClick dynamically to the lv.OnClick

lol and last thing, the ListView1_LongClick doesn't seem to work
 

Attachments

  • simple file manager.zip
    7.9 KB · Views: 379
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can catch the back key and then consume this event if needed:
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
    If KeyCode = KeyCodes.KEYCODE_BACK Then
        res = Msgbox2("Do you want to exit?", "", "Yes", "", "No", Null)
        If res = DialogResponse.NEGATIVE Then Return True
    End If
    Return False
End Sub
The LongClick event and Click event will be removed as they are not supported.

Your application looks nice!

BTW, currently a NullPointerException is raised when you try to open a folder which you don't have permissions to. I changed it and now ListFiles will return an uninitialized List object.
 
Upvote 0

mtw

Member
Licensed User
Longtime User
Erel is the File.Delete function working, tried it using (path,file) (path,path&file) path with / at the end and without still not deleting a file, even on /sdcard/(anything)
 

Attachments

  • simple file manager.zip
    8.1 KB · Views: 375
Upvote 0

mtw

Member
Licensed User
Longtime User
Doesn't work on my device, but to rid myself from those read errors I made a library to use with the following code now I just call the CanRead() before trying to get a listing, I would love your File class to have these 2

public class util {
/*
* @method CanRead
* @parameter String Dir, String Filename
* @return boolean
*/
public static boolean CanRead(String Dir, String FileName)
{
return new java.io.File(Dir, FileName).canRead();
}
/*
* @method CanWrite
* @parameter String Dir, String Filename
* @return boolean
*/
public static boolean CanWrite(String Dir, String FileName)
{
return new java.io.File(Dir, FileName).canWrite();
}

}
 
Upvote 0
Top