I am developing an Android application and maintaining Global Variables in an Application Class MyAppData. Now in order to use those global variables, I am creating the MyAppData object in my Activity as follows:
MyAppData mad;
mad = (MyAppData)getApplication();
As my activity have a custom Listview, I am using BaseAdapter to populate the LstView. Now i need to use the global variables in my BaseAdapter class. The following code doesnt allowing me to create an object of MyAppData class :
public class AlbumList_Adapter extends BaseAdapter{
Context context;
MyAppData mad;
      public AlbumList_Adapter(Context context){
      this.context = context
      mad = (MyAppData)getApplication();
      }
}
Even I had tried mad = (MyAppData)context; but no Luck. I dont know where I have mistaken.
 
    