I wanted to Display Calendar Icon as a Button In Android. I have created a Image Button as,
ImageButton DtPk = new ImageButton(this);
I know that image will set as,
Drawable d = Drawable.createFromPath("@drawable/calendar");
DtPk.setBackgroundDrawable(d);
But where do i store image in my project? And how.
When the project was created you should see a folder called “res” and inside it several different drawable folders. Place the image inside of the one called drawable-mdpi. Then simple do the following:
Here is another SO post explaining more about drawable folders: Drawable folders in res folder?
And read the section called Bitmap File in this document: http://developer.android.com/guide/topics/resources/drawable-resource.html