public class SetcolorActivity extends Activity {
    /** Called when the activity is first created. */
private TextView tips;
private ImageView img;
private int flag=0;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        tips=(TextView)findViewById(R.id.tips);
        img=(ImageView)findViewById(R.id.imageView1);
        img.setOnTouchListener(new View.OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
switch(event.getAction())
{
case MotionEvent.ACTION_MOVE:
if(flag==0)
{
 tips.setText("color is blue");
 tips.setTextColor(Color.BLUE);
 flag=1;
}
else
{
 tips.setText("color is red");
 tips.setTextColor(Color.RED);
}
case MotionEvent.ACTION_UP:
 tips.setText(" ");
break;
default:
break;
}
return true;
}
});
       
    }
}