Reputation: 66575
There are several custom-made graphic objects (.png files) included in the project inside res/drawable map.
All elements are normally loaded and displayed in the user interface except two icons and so far haven't figured out what causes the problem.
The code which doesn't affect the user interface as it should is the following:
if (settings.isMute()) {
muteIcon.setIconImage(R.drawable.ic_volume_off_small);
} else {
muteIcon.setIconImage(R.drawable.ic_volume_small);
}
In both cases there is only ic_volume_small
displayed on the screen and the Variables window in the IDE displays the following:
R.drawable.ic_volume_small = Class not loaded : net.client.android.R$drawable R.drawable.ic_volume_of_small = Class not loaded : net.client.android.R$drawable
The method (member of IconImage class) which should change the icon image is the following:
public void setIconImage(int imageFromResources) {
iconImage = BitmapFactory.decodeResource(getResources(), imageFromResources);
iconWidth = iconImage.getWidth();
iconHeight = iconImage.getHeight();
invalidate();
}
Does anyone know what could cause the described problem?
Thanks!
Upvotes: 0
Views: 2633
Reputation: 9213
If you recently added file, please refresh (press F5) the drawable directory and R is going to be generated again. Once R is regenerated, you can use the newly added resource.
Upvotes: 0
Reputation: 78033
Assuming what you want is the drawable from the Android framework and not your own, you'd want to use:
android.R.drawable.ic_volumne_off_small
rather than
R.drawable.ic_volume_off_small
(notice the android prefix).
Upvotes: 1