I'm converting RGB to Hexadecimal Colors using this code. I have 3 Edittext to input R, G and B. Now what I want to do is to convert it without using the API. Like converting and computing it with my own code and not by toHexString(). can someone help me to do that? Thanks a lot. Here is my code.
convert.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
final int r = Integer.parseInt(showRed.getText().toString());
final int g = Integer.parseInt(showGreen.getText().toString());
final int b = Integer.parseInt(showBlue.getText().toString());
final StringBuilder builder = new StringBuilder();
builder.append("#");
builder.append(Integer.toHexString(r)); // Real computation here
builder.append(Integer.toHexString(g)); // Real computation here
builder.append(Integer.toHexString(b)); // Real computation here
result.setText(builder.toString());
}
});