Back to project page binghamton_svc.
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.
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(); } }