In activity-context it's easy to override onDraw()-method by creating a custom class extended to View or in this case ImageView. Accessing that view is also easy with LayoutInflater or it's instance.
Now I'm developing an AppWidget, but there were used RemoteViews instead.
Any ideas how do that?
Ok. It seems that I've found a solution here in stackoverflow:
"Just create a Bitmap, create a Canvas with it, and then draw on it using what was your onDraw code. Then create an ImageView (which is allowed in a widget) and set the image it displays to your Bitmap." (Dynamically adding a View to an android widget)
Create a canvas through bitmap: (creating an empty bitmap and drawing though canvas in android)
Bitmap.Config conf = Bitmap.Config.ARGB_8888; // see other conf types
Bitmap bmp = Bitmap.createBitmap( 150, 150, conf ); // this creates a MUTABLE bitmap
Canvas cv = new Canvas( bmp );
//cv.draw...
After drawing I just need to push that bitmap to remoteViews.
Hope it helps you too!
=)