I'd like to make a Library containing an override class of View(eg: MyView extends View) and want to make a method "Draw(String FileName)".
So what I ultimately want to do is to simply import this library and call this "Draw(String FileName)" method to draw an image from other activities.
I've tried by myself, but I encountered some problem with accessing main Canvas which onDraw() method actually has.
It would be easy if I just draw every image in onDraw() method function, but I 开发者_C百科have no idea how to put things from outside the class.
any idea for this structure?
OK, I solved my problem but I'm not sure this is the best way.
I made an interface call back function inside the class which inherits View
,
and I could access the Draw()
method by using that call back.
精彩评论