I do what they describe here:

http://developer.android.com/guide/topics/graphics/index.html

in the "On a View: section...

Maybe I should try debugging with Hiearchy Viewer
http://developer.android.com/guide/developing/tools/hierarchy-viewer.html

K



On Jul 6, 11:31 am, android_interest <kar...@gmail.com> wrote:
> Maxood,
>
> I could post the source code but at this time i'm at a different
> location, so I don't have access.
>
> I am already using the onDraw of View. Subclassed a View and onDraw I
> draw the bitmap with canvas.drawBitmap(bitmap, locX, locY,
> bitmapPaint);
>
> It worked fine when I created 1 bitmap as a private of my subclassed
> view class (i.e. ClassX extends View { ..... private Bitmap
> characterBitmap = ... } ).
>
> All that changed is I created a Factory of Character types, gave
> Character its own private Bitmap attribute and I load it before the
> onDraw of the View executes.
>
> Anything that I could verify, verify the bitmap loaded (i inspected it
> with eclipse debug mode, looked fine), any reason why a bitmap would
> not load, other than  obvious (specifying the right R.drawable.id, or
> something else) ?
>
> Karl
>
> p.s. I have this book too, but thanks for pointing it out. :)
>
> On Jul 6, 3:39 am, Maxood <maqs...@salsoft.net> wrote:
>
> > Did you try using this method here:
>
> > @Override
> >         protected void onDraw(Canvas canvas)
> >         {
> >                 super.dispatchDraw(canvas);
> >                 paint(canvas);
> >         }
>
> > For more information download the source code of this book 
> > here:http://www.apress.com/book/downloadfile/4504
>
> > Thanks,
> > Maxood
>
> >http://www.maxood-android-corner.blogspot.com/
>
> > On Jul 5, 9:13 pm, android_interest <kar...@gmail.com> wrote:
>
> > > Hello,
> > > I have following example code:
>
> > > ....
> > > Character c =
> > > CharacterFactory.getCharacter(CharacterEnum.SpecialCharacter);
> > > //factory has applicationContext reference to get bitmaps from R.
> > > ...
> > > Paint bitmapPaint = new Paint();
> > > ...
>
> > > View::onDraw(Canvas canvas)
> > > ...
> > > canvas.drawBitmap(c.bitmap(), 0, 0, bitmapPaint);
> > > ...
>
> > > For some reason (must be something simple) I do not see the bitmaps at
> > > the 0,0 of the canvas.
>
> > > Inspecting the bitmap and etc does not show anything obvious (nulls),
> > > I must have missed something...
>
> > > Is there something I should be paying particular attention to while
> > > drawing bitmaps?

-- 
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