Convert int value to ARGB color value - Android android.graphics

Android examples for android.graphics:Color

Description

Convert int value to ARGB color value

Demo Code

public class Main {

  public static int[] fromARGB(int pixel) {
    int[] argb = new int[4];
    argb[0] = (pixel >> 24) & 0xFF;
    argb[1] = (pixel >> 16) & 0xFF;
    argb[2] = (pixel >> 8) & 0xFF;
    argb[3] = pixel & 0xFF;/* w ww. j a v a 2 s  .c  o  m*/
    return argb;
  }

}

Related Tutorials