I am using the following if else statement:
if (isInternetPresent) { try { startActivity(i2); } catch (Exception e) { AlertDialog.Builder builder = new AlertDialog.Builder( Main.this); builder.setTitle("Title"); builder.setMessage("Message"); AlertDialog alert = builder.create(); alert.show(); } } else { Toast.makeText(getApplicationContext(), "Please check your Internet Connection.", Toast.LENGTH_LONG).show(); } } });
the problem is when there is no internet connection, it shows the toast, but when i connect to the network (keeping my application on), it shows the same toast. Any help is appreciated
Aucun commentaire:
Enregistrer un commentaire