When the user opens the application, there is a screen with a button on it, which says "login." The user clicks on the button, and a webview pops up to allow him to log in to the website. After logging in (the app would need to know somehow),
Yo can do this with two separate Activity
classes. I would put the WebView
in its own Activity
. This is easier than managing lots of different View
objects yourself. Also, you'll get transitions between different things if you put each part in its own Activity
.
You'll can launch the login Activity
with the startActivityForResult()
method, allowing it to return if the login was successful or not.
If you want to detect the login, you can monitor events in a WebView
using a WebViewClient
. You set the WebViewClient
of your WebView
using the setWebViewClient()
method.
the webview would disappear,
Simply start the next Activity
using an Intent
and call the finish()
method on your first Activity
. If you do this then the use won't come back to login button Activity if they click back as it won't be on the stack any more.
What I'm not clear on is how long the login at the website will be valid for. You may need to set the flags on the Activities in your Manifest, to ensure the user has to log in again if they leave and then return to your application.
and then a list of usernames will pop up. (ListView?)
Use a ListActivity
. This is an Activity
which comes with the API designed for displaying a single ListView
.
When the user clicks on one of the usernames, a webview of the username's profile will pop up. Of course, when the user pushes "back", it goes back to the list of usernames.
So use the onListItemClick()
method in ListActivity
to detect the touch and launch a new Activity
containing the WebView
to show the profile. As this is in a new Activity
the back handling is all automatic.