on my Application-Class I defined a ACRA with these annotations
@ReportsCrashes(formKey = "",
mailTo = "my@email.de",
mode = ReportingInteractionMode.DIALOG,
//resToastText = R.string.crash_toast_text, // optional, displayed as soon as the crash occurs, before collecting data which can take a few seconds
resDialogText = R.string.crash_dialog_text,
resDialogIcon = android.R.drawable.ic_dialog_info, //optional. default is a warning sign
resDialogTitle = R.string.crash_dialog_title, // optional. default is your application name
resDialogCommentPrompt = R.string.crash_dialog_comment_prompt, // optional. when defined, adds a user text field input with this text resource as a label
resDialogOkToast = R.string.crash_dialog_ok_toast // optional. displays a Toast message when the user accepts to send a report.
)
public class AttachApplication extends Application implements OnSharedPreferenceChangeListener{
this works fine, but also I have button in my app where the user can send an error report manually. For that I want to change mode, so that only an email will be sent instead of a Dialog.
public void startSendErrorAction(View view) {
Log.d( TAG, "sending error to srs" );
ACRAConfiguration config = ACRA.getConfig();
int prevDialogTitle = config.resDialogTitle();
int prevDialogText = config.resDialogText();
config.setResDialogTitle( R.string.manual_error_title );
config.setResDialogText( R.string.manual_error_text );
ACRA.setConfig( config );
ACRA.getErrorReporter().handleException(null);
config.setResDialogText( prevDialogText );
config.setResDialogTitle( prevDialogTitle );
ACRA.setConfig( config );
}
I tried to change only the text and title of the dialog box but this wont work. It always uses the ones which are configured in the annotation.
Is it possible to overrite these values? Thanks
I think you want somethin like ACRA: sometimes dialog report and other times silent report but in the "opposite" direction. So first use SILENT in the configuration and reset it with DIALOG before setting the configuration.
来源:https://stackoverflow.com/questions/14382750/how-to-override-settings-of-acra-in-android