Skip to content
Snippets Groups Projects
Commit bc56e646 authored by Hadrien De Sousa's avatar Hadrien De Sousa
Browse files

fix: Fix a crash when user has a profile


The application is crashing if the he user has a profile for himself in
the android contacts

This commit fix the crash and display the user profile name

Change-Id: I2ad27ab4255e2a0a9f86b525010839e347a01d70
Reviewed-by: default avatarAline Bonnet <aline.bonnet@savoirfairelinux.com>
parent bae38f53
No related branches found
No related tags found
No related merge requests found
......@@ -99,7 +99,6 @@ public class ProfileCreationFragment extends BaseFragment<ProfileCreationPresent
}
}
presenter.initPresenter();
if (mPhotoView.getDrawable() == null) {
if (mSourcePhoto == null) {
mSourcePhoto = BitmapFactory.decodeResource(getActivity().getResources(), R.drawable.ic_contact_picture);
......@@ -109,6 +108,12 @@ public class ProfileCreationFragment extends BaseFragment<ProfileCreationPresent
return view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
presenter.initPresenter();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
......
......@@ -167,8 +167,9 @@ public class DeviceRuntimeServiceImpl extends DeviceRuntimeService {
Cursor mProfileCursor = mContext.getContentResolver().query(ContactsContract.Profile.CONTENT_URI, PROFILE_PROJECTION, null, null, null);
if (mProfileCursor != null) {
if (mProfileCursor.moveToFirst()) {
String profileName = mProfileCursor.getString(mProfileCursor.getColumnIndex(ContactsContract.Profile.DISPLAY_NAME_PRIMARY));
mProfileCursor.close();
return mProfileCursor.getString(mProfileCursor.getColumnIndex(ContactsContract.Profile.DISPLAY_NAME_PRIMARY));
return profileName;
}
mProfileCursor.close();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment