Convert the color value to hex - Android Graphics

Android examples for Graphics:Color Value

Description

Convert the color value to hex

Demo Code


//package com.java2s;

public class Main {
    /**// www.ja  v a 2 s . com
     * Convert the color value to hex
     * @param color
     * @return hex string
     */
    public static String colorToHex(int color) {
        return String.format("#%06X", (0xFFFFFF & color));
    }
}

Related Tutorials