Android - ResourcesNotFoundException when trying to set Action Bar icon by resource id -
Android - ResourcesNotFoundException when trying to set Action Bar icon by resource id -
i changing action bar icon circleimageview shows profile picture:
circleimageview actionbaricon_profile = new circleimageview(this); actionbaricon_profile.setimagedrawable(getresources().getdrawable(r.drawable.my_picture)); actionbaricon_profile.setlayoutparams(new layoutparams(48, 48)); actionbaricon_profile.setid(r.id.actionbaricon_profile); getactionbar().seticon(r.id.actionbaricon_profile);
the ids kept in ids.xml:
<?xml version="1.0" encoding="utf-8"?> <resources> <item type="id" name="actionbaricon_profile"/> </resources>
i resourcesnotfoundexception. help appreciated.
seticon
expecting receive id of resource. id actionbaricon_profile
unique id you're creating has no resource associated it. that's why you're getting resourcesnotfoundexception
.
you can set drawable actionbar's seticon
method. not imageview. need create circular drawable instead of circular imageview.
android resources android-actionbar
Comments
Post a Comment