在我的应用程序类上,我用这些注释定义了一个 ACRA
@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{
这工作正常,但我的应用程序中有按钮,用户可以手动发送错误报告。为此,我想更改模式,以便只发送一封电子邮件而不是一个对话框。
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 );
}
我试图只更改对话框的文本和标题,但这不起作用。它总是使用注释中配置的那些。
是否可以覆盖这些值?谢谢