android - getApplicationContext() on Universal Image Gallery is Undefined? -


i trying load images array , following schedule adapter. getting undefined context. not sure ? no images being loaded

public class schedule_arrayadapter extends arrayadapter<string> { private final activity activity; private final string[] name, category, image; typeface colab, colab_bold, bebas; int selected = -1;  public schedule_arrayadapter(activity activity, string[] name, string[] category, string[] image) {     super(activity, r.layout.schedule_item, category);     this.activity = activity;     this.name = name;     this.category = category;     this.image = image;      this.colab = typeface.createfromasset(activity.getassets(), "colabthi.otf");     this.colab_bold = typeface.createfromasset(activity.getassets(), "colabmed.otf");     this.colab_bold = typeface.createfromasset(activity.getassets(), "bebasneue.otf"); //  imageloader.getinstance().init(config);     imageloader = imageloader.getinstance(); }      imageloaderconfiguration config = new imageloaderconfiguration.builder(getapplicationcontext())     .memorycache(new weakmemorycache())     .denycacheimagemultiplesizesinmemory()     .threadpoolsize(5)     .enablelogging()     .build();      displayimageoptions options = new displayimageoptions.builder()     .cacheondisc()     .cacheinmemory()     .build();      imageloader imageloader= imageloader.getinstance(); 

simply use activity.getapplicationcontext() instead of getapplicationcontext()

your current class inherits arrayadapter, not subclass of context. getapplicationcontext() method available in classes inheriting context, activities, services , broadcastreceivers.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -