Use getApplicationContext()
instead of getContext()
to prevent memory leaks.
Using whatever `Activity` as the `Context` used to construct the first content provider means that it will be help onto in memory until the application is GC'ed.
This commit is contained in:
parent
63d3006ba8
commit
f7bbf0e282
@ -86,7 +86,7 @@ public abstract class FDroidProvider extends ContentProvider {
|
||||
}
|
||||
|
||||
protected final synchronized SQLiteDatabase db() {
|
||||
return getOrCreateDb(getContext()).getWritableDatabase();
|
||||
return getOrCreateDb(getContext().getApplicationContext()).getWritableDatabase();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user