質問

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

public class MyReportSender implements ReportSender {
    public ErrorReportSender(){}
}
役に立ちましたか?

解決

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;
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top