How get Drawable Android example

InputStream, getResources(),openRawResource()

 java.io.InputStream is;
is = context.getResources().openRawResource(R.drawable.my_image);
 
Drawable mDrawable = context.getResources().getDrawable(R.drawable.button);
mDrawable.setBounds(150, 20, 300, 100);
 
 
Drawable[] mDrawables;
int[] resIDs = new int[] {
                R.drawable.btn_ok,
                R.drawable.btn_storno,
                R.drawable.btn_help
            };
            mDrawables = new Drawable[resIDs.length];
            Drawable prev = mDrawable;
            for (int i = 0; i < resIDs.length; i++) {
                mDrawables[i] = context.getResources().getDrawable(resIDs[i]);
                mDrawables[i].setDither(true);
                addToTheRight(mDrawables[i], prev);
                prev = mDrawables[i];
            }
This entry was posted in Android Examples Code, Bitmap, drawing and tagged , . Bookmark the permalink.


Comments are closed.

3,495 views