c# - What is the reason behind this type of error? -
i'm getting below error when running app after deploy.
"android.content.res.resources+notfoundexception: file res/drawable-mdpi- v4/submenulistitem_background_top.xml drawable resource id #0x7f02008e"
the code giving error as:
txtlistitem.setbackgroundresource(resource.drawable.submenulistitem_background_top);
i have xml resource present in drawable folders , entry resource present in resource.designer.cs file. app running fine latest android devices, giving error in 1 of old android device. older device have api v10.
when drawable given in *.axml - android:background="@drawable/something" v10 device, finds , draws ui, when set drawable programmatically, type of error occurs, code adapter as:
using android.app; using android.views; using android.widget; namespace greenlee.ethernet.androiddevice { public class submenulistviewadapter : baseadapter<string> { string[] items; activity context; public submenulistviewadapter(activity context, string[] items) : base() { this.context = context; this.items = items; } public override long getitemid(int position) { return position; } public override string this[int position] { { return items[position]; } } public override int count { { return items.length; } } public override view getview(int position, view convertview, viewgroup parent) { view view = convertview; // re-use existing view, if 1 available textview txtlistitem = null; if (view == null) // otherwise create new 1 view = context.layoutinflater.inflate(resource.layout.submenulistitemlayout, null); txtlistitem = view.findviewbyid<textview>(resource.id.text1); if (position == 0) { txtlistitem.setbackgroundresource(resource.drawable.submenulistitem_background_top); // error line, checked setbackgrounddrawable() method too, no luck. } else if (items.length - position == 1) { txtlistitem.setbackgroundresource(resource.drawable.submenulistitembackgroundbottom); } else { txtlistitem.setbackgroundresource(resource.drawable.submenulistitembackground); } txtlistitem.text = items[position]; return view; } } }
Comments
Post a Comment