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

Reply via email to