Java – what is a better way to keep the adapter as an active internal class or external class?

I want to check for a better and faster way to use the listview program with the adapter Is it out or activity class?

Solution

This is more like a Java problem than Java

As long as static inner classes are used, inner classes can make code readable without affecting performance Static inner classes are extracted by the compiler and compiled into separate classes (class $innerclass)

Therefore, if it is helpful for you to use inner classes in code organization, you can safely continue to use them Although I strongly recommend using static inner classes

edit

Static inner class is sufficient in this context. It is an adapter that does not need to access any variables of activity

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>