Java - Set Color by switch case function
- by user369150
I want to set the color of the TextView by the function getcolorss. I tried a lot of different ways but i cant get in it. Please help me i think the solution is easy.
import java.awt.*;
import android.graphics.Color;
public class test extends Activity {
TextView text1 = (TextView) findViewById(R.id.text1);
text1.setTextColor(getcolorss(1));
public Color getcolorss(int x)
{
switch(x)
{
case 1: return Color.BLUE;
case 2: return Color.RED;
}
}
}