public static PermissionDialogFragment getInstance ( PermBean bean , int requestCode ) { if ( bean == null ) throw new NullPointerException ( "Permission Beans cannot be null !" ) ; Bundle extras = new Bundle ( 3 ) ; // convert map to two arrays. HashMap < Permission , String > map = ( HashMap < Permission , String > ) bean . getPermissions ( ) ; // put arrays in extras. extras . putSerializable ( PERMISSION , map ) ; extras . putInt ( REQUEST , requestCode ) ; // set extras in fragment and return. PermissionDialogFragment fragment = new PermissionDialogFragment ( ) ; fragment . setArguments ( extras ) ; return fragment ; }
A static dialog fragment instance creator method .