问题
Basically, this is what I'm trying to accomplish and nothing I've tried seems to work. Whenever there's a crash, before the ACRA report is sent, I'd like to display an EditText in a Dialog or something which allows the user to describe exactly what she was doing when this happened and give me some extra context for debugging. I know I can add whatever custom field to my crash report I want using ACRA.getErrorReporter().putCustomData(), but the problem is figuring out a way to display a view in which she could enter this text as the app is crashing. Logically, this seems impossible since the app has crashed, which would seem to preclude me from instantiating any type of view, but I figured I'd post here to see if anyone has any creative solutions before I give up.
回答1:
In ACRA 4.6.1 you can configure a custom dialog that it displayed when your app crashes. You could use that to include an EditText to capture the data and push it into the ACRA custom data.
回答2:
Best way I've found is to copy whole CrashReportDialog
to new class and change the implementation. BaseCrashReportDialog
is so basic that You generally need to write all the functionality in CrashReportDialog
yourself. On the other way You can not extend CrashReportDialog
because it hides many useful variables as privates. Then You can change
protected View buildCustomView(Bundle savedInstanceState)
implementation. Unfortunately all layout is set programatically and You can not just substitute one layout.xml with another one.
来源:https://stackoverflow.com/questions/28663330/add-user-input-to-acra-crash-report