I need to build an application to three types of users: Beginner, Intermediate and Advanced. Each level has a specific XML messages (written according to the user level) and will be charged in terms of performance. If the user sets the level PreferencesActivity Advanced, XML load application to display messages from this user-level …
How do I build it correctly?
onCreate () always invoke the XML level and pre-configured in Preferences Shared? I think this is a bad idea …
Thank you!
Mateus!
On the first run, you could have the user choose whether they’re Beginner, Intermediate, or Advance using 3 different buttons. Then in the
onClicksave to SharedPreferences which they chose, then inonCreateget what they chose and set accordingly. Here’s what I mean:You would do the same for the other two buttons, but make intermediate
putInt(..., 2), and advancedputInt(..., 3)Then in your PreferenceActivity in
onCreateI’d say that’s probably the easiest way to handle it.
If you have to set click listeners and things, though, it may be better to use three different activities with the same premise. You would have a start screen that would get “level” from sharedprefs and then
startActivity(...)based on what was returned.