I am getting started with some android development, and on the first screen of the app I am working on, I want the screen to display either a login/registration prompt, or the User’s photo, depending on whether or not they are logged in to the app.
Should I just scratch using the xml for this? or there a way I can get the xml to draw differently depending on whether or not the user has logged in?
It’s actually a good idea to keep your layouts in XML. Just create two layout files (one for each screen), and programmatically select one or the other based on login status.
You might want to try the Android tutorials to get started. Or if you want some more depth, try the Dev guide
*Edit
oops, forgot to call super.onCreate()
sgarman’s suggestion to create a separate login activity that automatically forward the user to your main activity is also quite viable, and he makes a good point regarding the modularity of that approach.
IMO that’s mostly a personal preference.