Hello Kostya, Thanks for the response. However, I don't know how to use the method findViewById in here:
View myView = (View)findViewById(MyView); What I understand is that findViewById () method should receive the id of an attribute. But MyView is just a class, it has not been instanciated, we just set the content in the main class FingerPrint by using setContentView(new MyView(this)); Any idea on how to use the findViewById to access MyView? Thanks in advance. On 7 Apr., 13:33, Kostya Vasilyev <[email protected]> wrote: > Keep a reference to MyView in the activity, just like you would normally > do with: > > findViewById(... buttonSomethingOrOther ... ) > > Add methods to MyView to do what you need. > > Call those methods as necessary, just like you can call > "mButton.setEnabled(false);" or whatever. > > -- Kostya > > 07.04.2011 15:26, Enrique López Mañas пишет: > > > > > Hello, > > > Using the example from the API FingerPaint as a basis, I have > > something similar to the following structure: > > > public class FingerPaint extends GraphicsActivity > > implements ColorPickerDialog.OnColorChangedListener { > > > [...] > > > @Override > > protected void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(new MyView(this)); > > [...] > > } > > > The class that has been set as contentView (MyView) contains a Canvas: > > > public class MyView extends View { > > [..] > > public Canvas mCanvas; > > [..] > > } > > > How could I access this mCanvas in order to redraw it when an external > > event is triggered (i.e., clicking a button from the menu). Obviously > > I can access them from FingerPaint, since the attributes from MyView > > are not inherited, but I can't neither access MyView directly, since > > it is "absorbed" by the class FingerPrint. > > > Any idea, before redesigning the classes? > > > Thanks! > > -- > Kostya Vasilyev --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

