On android how would I go about creating a prompt for an app that requires a user to enter a username before fully launching the app?
Posted
by
racl101
on Stack Overflow
See other posts from Stack Overflow
or by racl101
Published on 2012-04-10T17:26:03Z
Indexed on
2012/04/10
17:29 UTC
Read the original article
Hit count: 165
I'll preface this with I'm really new to working on Android.
So I have to work on an existing app and create a screen that prompts the user for a username if one isn't entered then it won't launch the currently existing main activity (i.e. it won't fully launch the app. Instead it will just sit on that screen until a username is entered.)
I suppose that it's tantamount to a web app login page in that it will not let a user past that page if the user is not authenticated and authorized. However, there's no authentication nor authorization in this app. Instead, on first run a user must simply register with a username and that username gets saved to the database and for any subsequent runs the app's main activity will just start because a user has registered to that phone. In fact, the app will not prompt the user for their name again unless the app gets deleted with all its data and reinstalled again.
This implicitly means that I have to save the user's name in the database or some other kind of storage.
So I was wondering what would be the best way of doing this in an app with an existing main activity?
Should I try to accomplish this on that existing main activity or create a new activity to display this prompt screen and, in effect, block the main activity from running until the user enters their name?
Any tutorials or links would be helpful and thank you in advance for any help.
© Stack Overflow or respective owner