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:
Peter Serwylo 2016-01-25 18:02:17 +11:00
parent 63d3006ba8
commit f7bbf0e282

View File

@ -86,7 +86,7 @@ public abstract class FDroidProvider extends ContentProvider {
} }
protected final synchronized SQLiteDatabase db() { protected final synchronized SQLiteDatabase db() {
return getOrCreateDb(getContext()).getWritableDatabase(); return getOrCreateDb(getContext().getApplicationContext()).getWritableDatabase();
} }
@Override @Override