Obtain Colors and Styles for Views in an Activity?

Put your problem here if it does not fit any of the other categories.

Obtain Colors and Styles for Views in an Activity?

Postby gilgantic » Sun Feb 24, 2008 11:14 pm

On Activity how do you obtain the original colors and styles for a View (or Views)? What I am doing is field validation, where I paint the field headers to Color.RED if they did not fill out the field. But before I do this I would like to find the original color or style, for instance white (Color.WHITE) if it was original white, so I can paint that field back to original color if the user corrects the validation. Example snippet of what I speaking of is below. How and where would I be able to accomplish this?

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class ApplicantActivity extends Activity {
  2.  
  3.         .
  4.  
  5.     private TextView firstname;
  6.  
  7.         .
  8.  
  9.     public void onCreate(Bundle icicle) {
  10.  
  11.         super.onCreate(icicle);
  12.  
  13.         setContentView(R.layout.applicant);
  14.  
  15.         firstname = (TextView) findViewById(R.id.firstname);
  16.  
  17.         .
  18.  
  19.     }
  20.  
  21.  
  22.  
  23.     protected void resetErrorFields() {
  24.  
  25.         .
  26.  
  27.         firstname.setTextColor(Color.WHITE);
  28.  
  29.         .
  30.  
  31.     }
  32.  
  33.  
  34.  
  35.     private OnClickListener saveClickListener = new OnClickListener() {
  36.  
  37.         public void onClick(View v) {
  38.  
  39.         .
  40.  
  41.         String aFirstname = firstname.getText().toString().trim();
  42.  
  43.         resetErrorFields();
  44.  
  45.         .
  46.  
  47.     }
  48.  
  49.  
  50.  
  51. }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4

Thanks in Advance! :D
gilgantic
Freshman
Freshman
 
Posts: 6
Joined: Sun Feb 24, 2008 11:08 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 14 guests