I am building an Android application that controls a device on the same network (details are irrelevant). The connection is set through TCP with sockets.
Here's what I'm trying to do :
- Show a dialog when the app launches asking the user to connect (the dialog has already been built!)
- Interrupt the activity if the connection is lost, and show another dialog
The app is built with a MainActivity, and a Fragment layout to manage the different tabs. Keep in mind that I am fairly new to Android programming, and I am mostly looking for the best way to code this instead of tinkering around :)
For now, relatively to the connection, I have a MainActivity that instantiate a "Connection" object in its onCreate() method. "Connection" itself executes an Asynctask when invoked to create and bind the socket to the server.
Thank you for your help!