get Color As Hex String - Android android.graphics

Android examples for android.graphics:Color

Description

get Color As Hex String

Demo Code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Iterator;
import java.util.UUID;

public class Main{

    public static String getColorAsHexString(int color) {
        return String.format("#%06X", (0xFFFFFF & color));
    }//from   w  w  w.j  av  a  2  s  .  c om

}

Related Tutorials