//drawable轉bitmap
Bitmap imageBitmap = BitmapFactory.decodeResource(myContext.getResources(), R.drawable.example);
//bitmap轉byte[]
ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
imageBitmap.compress(Bitmap.CompressFormat.JPEG, 100, byteOutStream);
byte[] imageBytes = byteOutStream.toByteArray();
//byte[]轉bitmap
if(imageBytes!=null)
imageBitmap = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);