Skip to content

Commit

Permalink
Catching some frequent IllegalStateExceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
jeisfeld committed Jun 12, 2017
1 parent f24ddd7 commit 3180992
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,12 @@ public static RetainFragment findOrCreateRetainFragment(@NonNull final FragmentM
RetainFragment fragment = (RetainFragment) fm.findFragmentByTag(TAG + index);
if (fragment == null) {
fragment = new RetainFragment();
fm.beginTransaction().add(fragment, TAG + index).commit();
try {
fm.beginTransaction().add(fragment, TAG + index).commit();
}
catch (IllegalStateException e) {
TrackingUtil.sendException("opv1", e);
}
}
return fragment;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,15 @@ public static void displayInfo(@NonNull final Activity activity, @Nullable final
}
DialogFragment fragment = new DisplayMessageDialogFragment();
fragment.setArguments(bundle);
fragment.show(activity.getFragmentManager(), fragment.getClass().toString());
try {
fragment.show(activity.getFragmentManager(), fragment.getClass().toString());
}
catch (IllegalStateException e) {
displayToast(activity, resource, args);
if (listener != null) {
listener.onDialogClick(fragment);
}
}
}

/**
Expand All @@ -119,7 +127,15 @@ private static void displayError(@NonNull final Activity activity, final int res

DialogFragment fragment = new DisplayMessageDialogFragment();
fragment.setArguments(bundle);
fragment.show(activity.getFragmentManager(), fragment.getClass().toString());
try {
fragment.show(activity.getFragmentManager(), fragment.getClass().toString());
}
catch (IllegalStateException e) {
displayToast(activity, resource, args);
if (listener != null) {
listener.onDialogClick(fragment);
}
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,12 @@ public static Bitmap getThumbnailFromPath(final String path, final int maxSize)
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = MINI_THUMB_SIZE / maxSize;
setDither(options);
return MediaStore.Images.Thumbnails.getThumbnail(resolver, imageId, MediaStore.Images.Thumbnails.MINI_KIND,
options);
try {
return MediaStore.Images.Thumbnails.getThumbnail(resolver, imageId, MediaStore.Images.Thumbnails.MINI_KIND, options);
}
catch (Exception e) {
return null;
}

}
catch (ImageNotFoundException e) {
Expand Down
2 changes: 1 addition & 1 deletion AugendiagnoseIdea/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
Expand Down

0 comments on commit 3180992

Please sign in to comment.