I think the problem is that the onCreate() is never called. I put a
little error message in the onCreate(), and it does not show in the
output.

Is there a way to draw a canvas without using an onCreate() or an
onDraw()? This would be a lot more useful for me...

For example, can I do something like this:


public class TestDraw extends Activity {

        public TestDraw() {
                TestViewDraw view = new TestViewDraw(getBaseContext());
                setContentView(view);
        }

        private class DemoView extends View{

                public DemoView(Context context){
                        super(context);

                        Bitmap b = Bitmap.createBitmap(100, 100, 
Bitmap.Config.RGB_565);
                        Canvas canvas = new Canvas(b);
                        canvas.drawColor(Color.WHITE);
                }
        }
}


On Mar 5, 3:01 pm, Mariano Kamp <mariano.k...@gmail.com> wrote:
> after the state of something you are interested in changes you can call
> invalidate() on the canvas which will afaik cause the canvas to be redrawn
> as soon as the UI thread gets to it.
>
> On Thu, Mar 5, 2009 at 8:09 PM, mcmc <manni...@gmail.com> wrote:
>
> > I have a method (let's call this methodA) and I would like the onDraw
> > function to be called in the middle of method A.
>
> > How would I do this? Right now, my onDraw is not being called at all.
>
> > private class DemoView extends View{
> >                public DemoView(Context context){
> >                        super(context);
> >                }
>
> >               �...@override protected void onDraw(Canvas canvas) {
> >                        super.onDraw(canvas);
> >                        canvas.drawColor(Color.WHITE);
> >                }
>
> >                public void methodA(){
> >                        // do something
>
> >                        // i want onDraw to be called here...
>
> >                        // do something
> >                }
> > }
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to