是否有办法在自定义ACRA ReportSender实现类中获得android上下文?
public class MyReportSender implements ReportSender {
public ErrorReportSender(){}
}
您可以将对Application
实现对象的引用保存到静态变量中,并使用静态方法获取它:
private static Application sInstance;
@Override
public void onCreate ()
{
sInstance = this;
ACRA.init( this );
super.onCreate();
}
public static Application getInstance()
{
return sInstance;
}