private void obtainWidth ( @ StyleRes final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogWidth } ) ; int defaultValue = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_width ) ; try { setWidth ( typedArray . getDimensionPixelSize ( 0 , defaultValue ) ) ; } catch ( Resources . NotFoundException | UnsupportedOperationException e ) { setWidth ( typedArray . getInteger ( 0 , defaultValue ) ) ; } }
Obtains the width from a specific theme .