@Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.vpn_create:
       {
         // Generate a new key. Here we just use the current time.
         long millis = System.currentTimeMillis();
         while (mPreferences.containsKey(Long.toHexString(millis))) {
           ++millis;
         }
         mDialog =
             new VpnDialog(getActivity(), this, new VpnProfile(Long.toHexString(millis)), true);
         mDialog.setOnDismissListener(this);
         mDialog.show();
         return true;
       }
     case R.id.vpn_lockdown:
       {
         LockdownConfigFragment.show(this);
         return true;
       }
   }
   return super.onOptionsItemSelected(item);
 }
    public static void show(VpnSettings parent) {
      if (!parent.isAdded()) return;

      final LockdownConfigFragment dialog = new LockdownConfigFragment();
      dialog.show(parent.getFragmentManager(), TAG_LOCKDOWN);
    }