I have a class thate extends a built-in dialog class, and I want to access sharedprefence in it, but having null pointer exception at that point.
Here is my code
public class DialogCancelOrder extends Dialog {
Context context;
public DialogCancelOrder(Context a, String orderid) {
super(a);
this.orderid = orderid;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sp = context.getSharedPreferences("afewtaps", Context.MODE_PRIVATE);
face = Typeface.createFromAsset(context.getAssets(), "fonts/Nunito-Regular.ttf");
face1 = Typeface.createFromAsset(context.getAssets(), "fonts/Rupee_Foradian_2.ttf");
}