I have an OnCLick listener class in my Android app defined as below. I need to access an application-level variable, but the last line in this code generates this compile error: "The method getApplication() is undefined for the type OnClickListenerSelectPresetItem"
How can I access Application variables from this class?
public class OnClickListenerSelectPresetItem implements OnClickListener {
private long glbMealId = ((MyApplication) this.getApplication()).getMealId();