Java – In Android, how would you develop it? ( Activity and Opinion Questions)

In Android, how would you develop it? ( Activity and Opinion Questions)… here is a solution to the problem.

In Android, how would you develop it? ( Activity and Opinion Questions)

When the user opens the application, a screen appears with a Sign In button.

The user clicks the button and a WebView pops up to log him in to the website.

After logging in (which the app needs to know somehow), WebView disappears and a list of usernames pops up. ( ListView ? )

When a user clicks on one of the usernames, the WebView of the username profile pops up. Of course, when the user presses the Back key, it returns to the list of usernames.

Can someone explain to me based on activity and views? Do I use two activities to do this? Do I hide WebView or ListView when the user clicks between them?

I

finished the tutorial (note this tutorial) but I’m still confused about the best way to develop it.

Thanks

Solution

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),

You can do this with two separate Activity classes. I would put the WebView in its own activity. This is easier than managing a large number of different View objects yourself. Also, if you put each part in its own activity, you will convert between different things.

You can use the startActivityForResult() method starts the login activity, allowing it to return whether the login was successful.

If you want to detect logins, you can use WebViewClient to monitor events in the WebView. You use > setWebViewClient() method Sets WebViewClient for WebView

the webview would disappear,

Simply use the intent to start the next activity and invoke it the finish() method On your first activity. If you do, then if they click Back, the user will not be returned to the sign-in button Activity because it is no longer in the stack.

I don’t know how long the site login is valid. You may need set the flags on the Activities in your Manifest to ensure that users must sign in again when they leave and return to your application.

and then a list of usernames will pop up. (ListView?)

Use > ListActivity Activity, which comes with an API 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 >onListItemClick() method in ListActivity detects touch and launches a new activity that contains a WebView to display the configuration file. Because this is in a new activity, return processing is automatic.

Related Problems and Solutions