0
有沒有辦法讓自定義ACRA ReportSender實現類中的android上下文?獲取Android上下文裏面的Acra reportSender實現
public class MyReportSender implements ReportSender {
public ErrorReportSender(){}
}
有沒有辦法讓自定義ACRA ReportSender實現類中的android上下文?獲取Android上下文裏面的Acra reportSender實現
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;
}
THX,不記得靜態的選擇! –