public static WiFiDialog newInstance(boolean wiFiEnabled) { WiFiDialog wiFiDialogFragment = new WiFiDialog(); Bundle args = new Bundle(); args.putBoolean(ARG_WIFI_ENABLED, wiFiEnabled); wiFiDialogFragment.setArguments(args); return wiFiDialogFragment; }
public static void showWiFiDialog(Activity activity) { FragmentManager fm = activity.getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag("dialog_wifi"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); WiFiDialog.newInstance(isWiFiEnabled(activity)).show(ft, "dialog_wifi"); }