Skip to content

Instantly share code, notes, and snippets.

@ok3141
Created May 7, 2015 13:37
Show Gist options
  • Save ok3141/b8566a0002fb76d07093 to your computer and use it in GitHub Desktop.
Save ok3141/b8566a0002fb76d07093 to your computer and use it in GitHub Desktop.
Prevent FC when starting 3rd-party Activity
public void startActivity(Intent intent) {
try {
super.startActivity(intent);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
}
}
@Override
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
try {
super.startActivityForResult(intent, requestCode, options);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
}
}
@Override
public void startActivityForResult(Intent intent, int requestCode) {
try {
super.startActivityForResult(intent, requestCode);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
}
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void startActivity(Intent intent, Bundle options) {
try {
super.startActivity(intent, options);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
}
}
@Override
public boolean startActivityIfNeeded(Intent intent, int requestCode) {
try {
return super.startActivityIfNeeded(intent, requestCode);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
return false;
}
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public boolean startActivityIfNeeded(Intent intent, int requestCode, Bundle options) {
try {
return super.startActivityIfNeeded(intent, requestCode, options);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
return false;
}
}
@Override
public boolean startNextMatchingActivity(Intent intent) {
try {
return super.startNextMatchingActivity(intent);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
return false;
}
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public boolean startNextMatchingActivity(Intent intent, Bundle options) {
try {
return super.startNextMatchingActivity(intent, options);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
return false;
}
}
@Override
public void startActivityFromChild(Activity child, Intent intent, int requestCode) {
try {
super.startActivityFromChild(child, intent, requestCode);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
}
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void startActivityFromChild(Activity child, Intent intent, int requestCode, Bundle options) {
try {
super.startActivityFromChild(child, intent, requestCode, options);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
}
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public void startActivityFromFragment(android.app.Fragment fragment, Intent intent, int requestCode) {
try {
super.startActivityFromFragment(fragment, intent, requestCode);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
}
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void startActivityFromFragment(android.app.Fragment fragment, Intent intent, int requestCode, Bundle options) {
try {
super.startActivityFromFragment(fragment, intent, requestCode, options);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
}
}
@Override
public void startIntentSenderFromChild(Activity child, IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags) throws IntentSender.SendIntentException {
try {
super.startIntentSenderFromChild(child, intent, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
}
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void startIntentSenderFromChild(Activity child, IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) throws IntentSender.SendIntentException {
try {
super.startIntentSenderFromChild(child, intent, requestCode, fillInIntent, flagsMask, flagsValues, extraFlags, options);
} catch (Throwable ex) {
if (SNAPSHOT) {
Log.wtf(LOG_TAG, ex);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment