Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了如何在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,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{

这工作正常,但我在我的应用程序中有按钮,@L_450_2@可以手动发送错误报告.为此,我想更改模式,以便只发送一封电子邮件而不是一个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 );
}

我试图只更改对话框的文本和标题,但这不起作用.它始终使用注释中配置的那些.

是否有可能覆盖这些值?
谢谢

解决方法

我想你想要像 ACRA: sometimes dialog report and other times silent report那样但处于“相反”的方向. 因此,首先在配置中使用SILENT,然后在设置配置之前使用DIALOG重置它.

大佬总结

以上是大佬教程为你收集整理的如何在Android中覆盖ACRA的设置全部内容,希望文章能够帮你解决如何在Android中覆盖ACRA的设置所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。