I need to design an application that opens to a screen with a button that says connect, and when the connect button is hit, it initiates a socket connection, and if the connection is successful it launches a new screen, but once the connection is faulted I need it to return to the connection screen. I know I need to run the networking actions in a async task thread, I am just not sure about what kind of logic to use to initiate the task, and have the async task network thread return a true value if th
Share
AsyncTask has onPostExecute method which runs on the UI thread. There you can check whether the socket connection is a success or not, and start an activity using StartActivity.
You can pass the URL to the class constructor that extends asynctask and using this url, you could start the socket connection.
hope that helps.