Separate ui from logic is the general rule.
I have a little experience on sqlite with B4A and B4J, use dbutils module functions as much as possible.
Queries are different in B4A (cursor) and B4J(resultset), so you have to avoid them, or make them based on dbutils functions.