java - The constructor Object(Context, int, List<DrawerItem>) is undefined -
please me resolve issue. i'm making drawer app , i'm receiving these errors adt:
the constructor object(context, int, list) undefined
the method getview(int, view, viewgroup) of type customdraweradapter must override or implement supertype method
this code customdraweradapter class:
package com.example.ico; import java.util.list; import android.app.activity; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.arrayadapter; import android.widget.imageview; import android.widget.textview; public class customdraweradapter { context context; list<draweritem> draweritemlist; int layoutresid; public customdraweradapter(context context, int layoutresourceid, list<draweritem> listitems) { super(context, layoutresourceid, listitems); this.context = context; this.draweritemlist = listitems; this.layoutresid = layoutresourceid; } @override public view getview(int position, view convertview, viewgroup parent) { // todo auto-generated method stub draweritemholder drawerholder; view view = convertview; if (view == null) { layoutinflater inflater = ((activity) context).getlayoutinflater(); drawerholder = new draweritemholder(); view = inflater.inflate(layoutresid, parent, false); drawerholder.itemname = (textview) view .findviewbyid(r.id.drawer_itemname); drawerholder.icon = (imageview) view.findviewbyid(r.id.drawer_icon); view.settag(drawerholder); } else { drawerholder = (draweritemholder) view.gettag(); } draweritem ditem = (draweritem) this.draweritemlist.get(position); drawerholder.icon.setimagedrawable(view.getresources().getdrawable( ditem.getimgresid())); drawerholder.itemname.settext(ditem.getitemname()); return view; } private static class draweritemholder { textview itemname; imageview icon; } }
to fix problems, need make class extend arrayadapter.
public class customdraweradapter extends arrayadapter {
Comments
Post a Comment