OptionsMenu and Canvas

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

OptionsMenu and Canvas

Postby alessandro » Sun Nov 08, 2009 7:56 pm

Hi,

I've a canvas with 2 lines.
I'd would like to change the color of lines by OptionsMenu().

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. ...
  2.  
  3.  @Override
  4.  
  5.     public boolean onCreateOptionsMenu(Menu menu) {
  6.  
  7.         super.onCreateOptionsMenu(menu);
  8.  
  9.        
  10.  
  11.         menu.add(0, 0, 0, "LineA");
  12.  
  13.          menu.add(0, 1, 0, "lineB") ;
  14.  
  15.          return true;
  16.  
  17.      }
  18.  
  19.        
  20.  
  21.     @Override
  22.  
  23.     public boolean onPrepareOptionsMenu(Menu menu) {
  24.  
  25.         super.onPrepareOptionsMenu(menu);
  26.  
  27.         return true;
  28.  
  29.     }
  30.  
  31.     @Override
  32.  
  33.      public boolean onOptionsItemSelected(MenuItem item) {
  34.  
  35.          
  36.  
  37.                 switch (item.getItemId()) {
  38.  
  39.                         case 0:
  40.  
  41.                                 paintTextB.setColor(Color.GRAY);
  42.  
  43.                                 PaintB.setAlpha(50);            
  44.  
  45.                             return true;
  46.  
  47.                         case 1:
  48.  
  49.                           //some...
  50.  
  51.                             return true;
  52.  
  53.         }  
  54.  
  55.          return false;
  56.  
  57.      }
  58.  
  59.  
  60.  
  61.  
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


I know I should call invalidate() methode, but where ??
Any ideas ?

thk
alessandro
Freshman
Freshman
 
Posts: 8
Joined: Tue Jun 30, 2009 1:16 pm
Location: Paris

Top

Postby alessandro » Tue Nov 10, 2009 10:56 am

No ideas ?
:cry:
alessandro
Freshman
Freshman
 
Posts: 8
Joined: Tue Jun 30, 2009 1:16 pm
Location: Paris

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 18 guests