Android Open Source - binghamton_svc Is Online Dialog Fragment






From Project

Back to project page binghamton_svc.

License

The source code is released under:

MIT License

If you think the Android project binghamton_svc listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package Fragments;
// w  ww.j  a  v  a 2 s .co  m
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

/**
 * Fragment in charge of checking for the existence of a connected internet.
 * @author Christopher Zhang
 */
public class IsOnlineDialogFragment extends DialogFragment 
{
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) 
  {
      AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
      builder.setMessage("No internet detected. Connection is required. Restart app?")
             .setPositiveButton("Restart", new DialogInterface.OnClickListener() 
       {
                 public void onClick(DialogInterface dialog, int id) 
         {
                   Intent i = getActivity().getPackageManager()
                       .getLaunchIntentForPackage( getActivity().getPackageName() );
            i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(i);
                 }
             })
             .setNegativeButton("Proceed", new DialogInterface.OnClickListener() 
       {
                 public void onClick(DialogInterface dialog, int id) 
         {
                 }
             });
      return builder.create();
  }
 }




Java Source Code List

Fragments.AboutSectionFragment.java
Fragments.ContactSectionFragment.java
Fragments.EventsSectionFragment.java
Fragments.IsOnlineDialogFragment.java
Fragments.LaunchpadSectionFragment.java
Fragments.SignupSectionFragment.java
Parsers.GetEBoard.java
Parsers.GetMembershipInfo.java
Parsers.GetMissionStatement.java
Parsers.GetVolunteerHours.java
com.github.chrzhang.AboutAdapter.java
com.github.chrzhang.MainActivity.java
com.github.chrzhang.SplashScreen.java