I always use
allowmainthreadqueries() in Android Room. But many people say it is not recommend to do it.
With this function, Room is very easy to use.
But if i should change my app to not using this function, How do I do that?
Is there an effective way to do it?
Yes, It is not a good approach to query DB on Main Thread. There are different ways, to keep the DB operation off the main(UI) thread, Mainly
Out of the above, the best option would always depend upon what is your use case.
But the first three are the best options to use. since they provide a callback on the result of a query.