私はすべてを試しましたが、これは どこでもアプリケーションコンテキストを使用していますか? さらにいくつかのことがあり、何も機能しません。
Exception を拡張する DatabaseException クラスにアプリケーション コンテキストが必要です。sharedpreferences
例外が発生したときにいくつかチェックしたいので必要です。コードは基本的にこれです:
public class DatabaseException extends Exception {
private static final long serialVersionUID = 1L;
DatabaseException(){
super();
}
DatabaseException(String s){
super(s);
}
public DatabaseException (String s, Throwable t){
super (s,t);
kindOfException(t.getCause(), s);
}
DatabaseException (Throwable t){
super (t);
kindOfException(t.getCause(), null);
}
...
private void createLog() {
Log.d("Database Exception","On Create Log");
String listLogs;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(DatabaseException.class.context);
もちろんこれはうまくいきません。それで...お願い、誰か私を助けてくれませんか?