在我的应用程序类中,我使用这些注释定义了一个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 );
}
我试图仅更改对话框的文本和标题,但这不起作用。它总是使用在注释中配置的内容。
是否可能覆盖这些值? 谢谢