title: adding an alert dialog box with a retry button
body: <p>I am working on a project where an alert dialog box appears if there is no internet connection on the phone.
  This alert dialog box says that Network is Unavailable and has a button "Retry" where the user retry the internet connection test.</p>
  
  <p>How can i implement this button correctly ? is there a "goto" statement so it can repeat if there is no internet connection ? i tried the labeled break and continue it didn't work.</p>
  
  <p>This is my code: </p>
  
  <pre><code>if(isNetworkAvailable())
      {
          GetBlogPostsTask getBlogPostsTask = new GetBlogPostsTask();
          getBlogPostsTask.execute();
      }
      else
          {
              AlertDialog.Builder builder = new AlertDialog.Builder(this);
              builder.setTitle("ERROR !!");
              builder.setMessage("Sorry there was an error getting data from the Internet.\nNetwork Unavailable!");
  ;
              builder.setPositiveButton("Retry", new DialogInterface.OnClickListener()
              {
                  @Override
                  public void onClick(DialogInterface dialog, int which)
                  {
  
                  }
              });
              AlertDialog dialog = builder.create();
              dialog.show();
              Toast.makeText(this, "Network Unavailable!", Toast.LENGTH_LONG).show();
          }
  </code></pre>