Buggy code:
public class VectorRoomSettingsFragment extends PreferenceFragment implements SharedPreferences . OnSharedPreferenceChangeListener { private static final String LOG_TAG = "VectorRoomSetFragment" ; private static final boolean UPDATE_UI = true ; private static final boolean DO_NOT_UPDATE_UI = false ; private static final int REQ_CODE_UPDATE_ROOM_AVATAR = 16 ; private static final String EXTRA_MATRIX_ID = "KEY_EXTRA_MATRIX_ID" ; private static final String EXTRA_ROOM_ID = "KEY_EXTRA_ROOM_ID" ; public static final String PREF_KEY_ROOM_PHOTO_AVATAR = "roomPhotoAvatar" ; public static final String PREF_KEY_ROOM_NAME = "roomNameEditText" ; public static final String PREF_KEY_ROOM_TOPIC = "roomTopicEditText" ; public static final String PREF_KEY_ROOM_PRIVACY_SWITCH = "roomPrivacySwitch" ; public static final String PREF_KEY_ROOM_MUTE_NOTIFICATIONS_SWITCH = "muteNotificationsSwitch" ; private MXSession mSession ; private Room mRoom ; private BingRulesManager mBingRulesManager ; private RoomAvatarPreference mRoomPhotoAvatar ; private EditTextPreference mRoomNameEditTxt ; private EditTextPreference mRoomTopicEditTxt ; private SwitchPreference mRoomPrivacySwitch ; private SwitchPreference mRoomMuteNotificationsSwitch ; private View mParentLoadingView ; private View mParentFragmentContainerView ; private IMXNetworkEventListener mNetworkListener = new IMXNetworkEventListener ( ) { @ Override public void onNetworkConnectionUpdate ( boolean isConnected ) { } } ; private final MXEventListener mEventListener = new MXEventListener ( ) { @ Override public void onLiveEvent ( final Event event , RoomState roomState ) { } @ Override public void onBingRulesUpdate ( ) { } } ; public static VectorRoomSettingsFragment newInstance ( String aMatrixId , String aRoomId ) { } @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override public void onViewCreated ( View view , Bundle savedInstanceState ) { } @ Override public void onPause ( ) { } @ Override public void onResume ( ) { } private void updateUi ( ) { } private void updateUiOnUiThread ( ) { } private void updatePreferenceAccessFromPowerLevel ( ) { } private void updatePreferenceUiValues ( ) { } @ Override public void onSharedPreferenceChanged ( SharedPreferences aSharedPreferences , String aKey ) { } private void onRoomMuteNotificationsPreferenceChanged ( ) { } private void onRoomNamePreferenceChanged ( ) { } private void onRoomTopicPreferenceChanged ( ) { } private void onRoomAvatarPreferenceChanged ( ) { } @ Override public void onActivityResult ( int aRequestCode , int aResultCode , final Intent aData ) { } private void onActivityResultRoomAvatarUpdate ( int aResultCode , final Intent aData ) { Uri thumbnailUri = null ; ClipData clipData = null ; Bitmap thumbnailBitmap = null ; if ( null == ( mSession ) ) { return ; } if ( aResultCode == ( Activity . RESULT_OK ) ) { if ( null != aData ) { if ( ( VERSION . SDK_INT ) >= ( VERSION_CODES . JELLY_BEAN_MR2 ) ) { clipData = aData . getClipData ( ) ; } if ( null != clipData ) { if ( ( clipData . getItemCount ( ) ) > 0 ) { thumbnailUri = clipData . getItemAt ( 0 ) . getUri ( ) ; } } else if ( null != ( aData . getData ( ) ) ) { thumbnailUri = aData . getData ( ) ; } if ( null != thumbnailUri ) { <START_BUG> thumbnailBitmap = VectorUtils . getBitmapFromuri ( getActivity ( ) , thumbnailUri ) ; <END_BUG> } else { return ; } String thumbnailUrl = mSession . getMediasCache ( ) . saveBitmap ( thumbnailBitmap , null ) ; if ( null != thumbnailUrl ) { displayLoadingView ( ) ; ResourceUtils . Resource resource = ResourceUtils . openResource ( getActivity ( ) , Uri . parse ( thumbnailUrl ) ) ; if ( null != resource ) { mSession . getContentManager ( ) . uploadContent ( resource . contentStream , null , resource . mimeType , null , new ContentManager . UploadCallback ( ) { @ Override public void onUploadStart ( String uploadId ) { } @ Override public void onUploadProgress ( String anUploadId , int percentageProgress ) { } @ Override public void onUploadComplete ( final String anUploadId , final ContentResponse uploadResponse , final int serverResponseCode , final String serverErrorMessage ) { getActivity ( ) . runOnUiThread ( new Runnable ( ) { @ Override public void run ( ) { if ( ( null != uploadResponse ) && ( null != ( uploadResponse . contentUri ) ) ) { mRoom . updateAvatarUrl ( uploadResponse . contentUri , new org . matrix . androidsdk . rest . callback . ApiCallback < Void > ( ) { @ Override public void onSuccess ( Void info ) { Log . d ( VectorRoomSettingsFragment . LOG_TAG , "##onActivityResultRoomAvatarUpdate():<seq2seq4repair_space>update<seq2seq4repair_space>succeed" ) ; hideLoadingView ( VectorRoomSettingsFragment . UPDATE_UI ) ; } @ Override public void onNetworkError ( Exception e ) { Log . w ( VectorRoomSettingsFragment . LOG_TAG , "##onActivityResultRoomAvatarUpdate():<seq2seq4repair_space>update<seq2seq4repair_space>failure<seq2seq4repair_space>-<seq2seq4repair_space>NetworkError" ) ; hideLoadingView ( VectorRoomSettingsFragment . DO_NOT_UPDATE_UI ) ; } @ Override public void onMatrixError ( MatrixError e ) { Log . w ( VectorRoomSettingsFragment . LOG_TAG , "##onActivityResultRoomAvatarUpdate():<seq2seq4repair_space>update<seq2seq4repair_space>failure<seq2seq4repair_space>-<seq2seq4repair_space>MatrixError" ) ; hideLoadingView ( VectorRoomSettingsFragment . DO_NOT_UPDATE_UI ) ; } @ Override public void onUnexpectedError ( Exception e ) { Log . w ( VectorRoomSettingsFragment . LOG_TAG , "##onActivityResultRoomAvatarUpdate():<seq2seq4repair_space>update<seq2seq4repair_space>failure<seq2seq4repair_space>-<seq2seq4repair_space>UnexpectedError" ) ; hideLoadingView ( VectorRoomSettingsFragment . DO_NOT_UPDATE_UI ) ; } } ) ; } else { hideLoadingView ( VectorRoomSettingsFragment . DO_NOT_UPDATE_UI ) ; } } } ) ; } } ) ; } } } } } private void displayLoadingView ( ) { } private void hideLoadingView ( boolean aIsUiRefreshRequired ) { } private void enablePreferenceWidgets ( boolean aIsEnabled ) { } }

Fix:
thumbnailBitmap = VectorUtils . getThumbnailBitmapFromUri ( getActivity ( ) , thumbnailUri , mSession . getMediasCache ( ) ) ;