android Suspicious method call; should probably call "draw" rather than "onDraw"

来源:互联网 发布:lvs和nginx的区别 编辑:程序博客网 时间:2024/04/30 21:47

  在ADT下,导入一个项目提示出:

Suspicious method callshould probably call "drawrather than"onDraw"

  查看代码没有问题,最后修改了onDraw-->Fix_onDraw.错误排除。

参考:


http://stackoverflow.com/questions/19124296/android-ondraw-is-a-suspicous-method-call/21311875#21311875

其中提到:

By convention, methods from Android API named like On*** should not be called directly by your code, but only by Android OS itself. I hope, someone will tell you what to use instead of it in this situation...
For the performance: if performance can become a problem, why don't you use OpenGL? (or a library that uses OpenGL)


http://stackoverflow.com/questions/14865434/override-ondraw-or-draw


   另一个问题,关于引用:import org.jetbrains.annotations.NotNull;

   解决办法,就是去掉代码中的标注。@Nullable and @NotNull 


参考:

http://stackoverflow.com/questions/19975022/org-jetbrains-what-is-it

@Nullable and @NotNull annotations introduced in IntelliJ IDEA for catching NullPointerException's (NPE's) through the Constant Conditions & Exceptions and @Nullable problem inspections. You canDownload last version here.

0 0
原创粉丝点击