Reputation: 3453
I have an application which shows a login screen as the first activity.
Due to some new language features in my application, I now want to optionally show a 'select language screen' which allows the user to select a language before displaying the login screen.
Depending on an application setting, which indicates the valid languages, I want to either show the login screen, or the language screen assuming there is more than one language to select from.
As far as I can see, I've got 3 options.
I could create a splash screen activity, which is a blank screen. This activity could determine whether to show the language screen, or the login screen, and just start the activity.
I've already sub-classed the Application object, so I'm guessing that I could fire off the relevant activity directly from the OnCreate
method of the application?
Always show the language selection screen as the first activity, and if it's not needed, just fire up the login activity.
I was wondering if there's a preferred way of doing this?
Upvotes: 0
Views: 280
Reputation: 12672
Why can't you just show a non-cancelable dialog on your login screen? You can assume English to be the default language and if the user changes it then you can restart the activity if needed or change the strings yourself.
The second approach won't work because you need to have an activity that starts with the app; you can't just start an android.app.Application
instance.
Upvotes: 1
Reputation: 1898
I can't speak to options 1 or 2, but I have used an approach similar to option 3. In the onCreate for your language selection activity, if you determine it's not needed, just start an intent for the login activity. This will run before the view is rendered, so the user will never see it.
Upvotes: 0
Reputation: 2705
What about showing the login screen as the first screen, and add Preferences activity that users can access to select a different language.
Upvotes: 0