I am currently trying to call a method from a utility class that will reference a new cursor created for this utility method. Unfortunately, my new class will not let me cr
Create a class that extends Application for your project (you have to declare it in the Manifest too), in the Application make a
private static MyApplication app
in the onCreate() of it assign it to the field
app = this;
and make a
public static MyApplication get()
in it. When you need a Context you can use a
MyApplication.get()
A few hints on Context:
Get Context in you View via getContext()
and pass it to getContentResolver(context)
.
Use application-context approach as described here by @apps.
Don't store context inside Activity or Views. This leads to memory leaks.