Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/216.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Android中覆盖ACRA的设置_Android_Acra - Fatal编程技术网

如何在Android中覆盖ACRA的设置

如何在Android中覆盖ACRA的设置,android,acra,Android,Acra,在我的应用程序类中,我用这些注释定义了一个ACRA @ReportsCrashes(formKey = "", mailTo = "my@email.de", mode = ReportingInteractionMode.DIALOG, //resToastText = R.string.crash_toast_text, // optional, displayed as soon as the crash occurs

在我的应用程序类中,我用这些注释定义了一个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 );
}
我试图只更改对话框的文本和标题,但这不起作用。它始终使用注释中配置的注释

是否有可能过高估计这些值?
谢谢

我想你想要像这样但方向相反的东西。
因此,首先在配置中使用静默,并在设置配置之前使用对话框重置它。

可能会有一个选项,根据一些额外的输入,使对话框显示在
errorreporter
类中。我已经用静默/非静默错误实现了这一点。您有用于此的示例代码吗?我试过了,但不起作用,出现了一个例外,ResToastText没有设置,尽管我在代码中设置了ResToastText。对不起,我没有设置。不过,我可能会尽力帮助你。你能帮我加上密码吗。