Android-drawable, Bitmap, byte[], resource files convert each other

Source: Internet
Author: User

In the development of Android, we can often encounter the processing of images, many of which are Bitmap, drawable, byte[] and resource files which are directly converted to each other.

Today, we summarize this:

1. Conversion of resource files to drawable

2. Conversion of resource files to bitmap

3, Bitmap turn drawable

4, drawable turn bitmap

5. Bitmap to byte array

6. drawable to byte array

7, byte array turn bitmap

8, byte array turn drawable

The above code is also relatively simple, not explained here!

2016-10-29

Android-drawable, Bitmap, byte[], resource files convert each other

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.