Static context

How to create static context in Android Studio without error message.

AndroidManifest.xml

< ?xml version="1.0" encoding="utf-8"?>

    
        
        
    

your.package.name.App.java

package your.package.name;
import android.app.Application;
import android.content.Context;

public class App extends Application {
    private static App app;

    static Context getContext() {
        return app.getApplicationContext();
    }

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
    }