Since you are new to B4X, if you have interest in using a B4XPages project as opposed to a default project which you are engaged in now, I can rewrite the above project for you using the more preferable way which is B4XPages.. This of course hinges on whether you are already comfortable with what you are doing now and do not want to make any switch at the moment to rock the boat.
In addition, I can make it to use Resultset instead of Cursor, xCustomlistview instead of the old Listview. Normally, with someone new like you,, the community recommends the newer types of projects and methods to stay on top of things. But, the old ways work too, if you are content to stay that way.