Tomtom G wrote: > Hi everyone, > > I'm currently developing an application with custom drawables and i'm > kind of lost. > I do not use XML since all kind of the parameters have to be computed > on the fly. > I have a main custom view holding all the gui. > I made a class mcDrawable extending drawable implementing > Drawable.Callback. > In its draw method, i draw a couple of primitive (circles, and so on) > An instance of mcDrawable is displayed via the onDraw method of the > view. > > When I trigger a motionEvent in the view, it calls a certain method in > an instance of mcDrawable which modifies the shapes. Since I call an > invalidate() after each event in the view, the drawable is updated > nicely during the motion. So far, all is good. > > When I stop the motion (ACTION_UP), it triggers another method in the > instance of mcDrawable which send a message to an Handler in > mcDrawable which animate it by the mean of delayed messages. However, > the View is not aware of these changes and therefore, does not redraw > the drawable. > To achieve the proper behavior, i made the view static, with a > Handler, and send a message from mcDrawable Handler to the one of the > view. When the view receive it, it invalidates. However, I don't think > that its the proper way to achieve this ! > > So my question is the following: is there a proper way for mcDrawable > to ask the View to redraw it, by the mean of Drawable.Callbacks for > example ? I understand that it may use a selfInvalidate() in > mcDrawable, but I don't understand how to link it to the view. Could > someone help me ? > > Thanks !
i think you probably need to override verifyDrawable http://developer.android.com/intl/fr/reference/android/view/View.html#verifyDrawable(android.graphics.drawable.Drawable) pskink -- 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

