Android_on开头命名的方法

It’s just a convention.

Android’s callbacks respond to events. You react to events when they occur. So when an event occurs you do something. Therefore:

onOccurrence() {
  doSomething;
}

why not?

As they correspond to “events” and in Android all “event” method start with the “on” prefix.

I really didn’t like this at the beginning as it’s not a java convention, but, after all, why not?

posted @ 2021-05-28 13:33  xuchaoxin1375  阅读(12)  评论(0)    收藏  举报  来源