Android getSystemService inside custom ArrayAdapter -


i trying write custom arrayadapter referencing here code

package com.example.andtest;  import java.util.arraylist;  import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.arrayadapter; import android.widget.textview;  public class categoryadapter extends arrayadapter<category> {     private arraylist<category> items;      public categoryadapter(context context, int textviewresourceid,             arraylist<category> items) {         super(context, textviewresourceid, items);         this.items = items;     }      @override     public view getview(int position, view convertview, viewgroup parent) {         view v = convertview;         if (v == null) {             layoutinflater vi = (layoutinflater) getsystemservice(context.layout_inflater_service);             v = vi.inflate(r.layout.list, null);         }         category c = items.get(position);         if (c != null) {             textview itemid = (textview) v.findviewbyid(r.id.itemid);             textview itemlabel = (textview) v.findviewbyid(r.id.itemlabel);             if (itemid != null) {                 itemid.settext("name: " + c.getid());             }             if (itemlabel != null) {                 itemlabel.settext("status: " + c.gettitle());             }         }         return v;     } } 

but i'm getting error message on line layoutinflater vi = (layoutinflater) getsystemservice(context.layout_inflater_service);

the method getsystemservice(string) undefined type categoryadapter

am missing something..

public class category implements parcelable { .... } 

getsystemservice method of context class, try context object first:

layoutinflater vi = (layoutinflater) getcontext().getsystemservice(context.layout_inflater_service); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -