0

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

public class MyReportSender implements ReportSender {
    public ErrorReportSender(){}
}
4

1 回答 1

1

您可以Application将对实现对象的引用保存到静态变量中并使用静态方法获取它:

    private static Application sInstance;

@Override
public void onCreate ()
{
    sInstance = this;
    ACRA.init( this );
    super.onCreate();
}
public static Application getInstance()
{
  return sInstance;
}
于 2013-05-21T21:05:28.453 回答