Friday, December 24, 2010

R.drawable cannot be resolved

I'm jumping into Android head first and wanted to make a button that when I press it, it trigger's a notification on the notification bar at the top of the screen.  I was browsing through the documentation and ran into this error.

If you look at the Android Notification Documentation example, you'll notice this line in step 2: int icon = R.drawable.notification_icon;. If you use their example in a tutorial you'll find that this icon doesn't exist and you can't compile your app.  The reason for this is that there is no notification_icon image that exists within /res/drawable-*/.  By default, icon.png exists within these directories.  If you change the notification_icon to icon it will work fine.

No comments:

Post a Comment