Demo entry 6786647

11

   

Submitted by anonymous on Apr 01, 2019 at 22:20
Language: Java. Code size: 622 Bytes.

public class BestManagerEver {
    private static BestManagerEver mInstance;
    private static Context mContext;

    private void BestManagerEver(Context context) {
        mContext = context;
    }

    public static getInstance(Context context) {
        if(mInstance == null) {
            mInstance = new BestManagerEver(Context context);
        }
        return mInstance;
    }
}

public class MainActivity {
    ...
    public void onCreate(Bundle savedInstanceState) {
        super(savedInstanceState);
        BestManagerEver manager = BestManagerEver.getInstance(this);
    }
    ...
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).