I´m developing an app which needs to connect to a server to actually work. That means when the server is not working, it should show a message to the user and close the app. Right now when it happens the app throws an IOException, and the app stops working.
The code is:
ConexionHttpPost conexion = new ConexionHttpPost(); //
try {
info = conexion.peticionServer(usuario, latitud, longitud,"A");
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
So what I want is to show a message which tells to the user the server is not working and close the app when ClientProtocolException or IOException happen. I have tried to show an AlertDialog already but it doesn´t work...
Any help? Thanks in advance.