0

Is there a way to get android context inside custom ACRA ReportSender implementation class?

public class MyReportSender implements ReportSender {
    public ErrorReportSender(){}
}
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

1

You can save reference to object of your Application implementation into the static variable and get it using static method:

    private static Application sInstance;

@Override
public void onCreate ()
{
    sInstance = this;
    ACRA.init( this );
    super.onCreate();
}
public static Application getInstance()
{
  return sInstance;
}
koral
  • 2,513
  • 1
  • 32
  • 41