Note that there are some explanatory texts on larger screens.

plurals
  1. POLogic loaded in memory vs in the database in Android
    text
    copied!<p>I have a question about what is the best approach for an generic Android app for showing static and dynamic info (with persistent info):</p> <p>Lets imagine an simple app with some persistent collections and some relations between those items: for example an app that shows a list of <strong>pilots</strong> a list of <strong>car pilots</strong> and a list of <strong>favorite pilots</strong> for the user. The user can manually refresh a pilot or a car profile and the new data must be saved persistently </p> <p>A) Use mechanisms for loading from the database the corresponding classes and Lists (for example) into logic classes, accessing them with managers (<strong>PilotManager</strong> for example) and reflecting the changes that affect persistently to those objects and, in parallel, reflect the changes in the data base. Those objects stay in memory while the app is running.</p> <p>B) Work directly with the database engine, recovering from there in each moment the elements needed for display or work. For example for listing the <strong>pilots</strong> query the database and use an CursorAdapter for list them. If a pilot is selected query the database for his car and show its values. Any change is directly saved to the database and refreshed from there.</p> <p>I generally use the method A) because is very fast granting the user a high responsivity in the interaction because (except in the first load) no database accesses are required. But a friend told me that B) is better because you use less memory and you can seize the database engine for handle complex filters of searches.</p> <p>Are both approaches valid? Someone is wrong? Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload