I created an activity for my Android project and decided to change the access modifier for the nested Fragment class to "private", I figured that the outer Activity class is the only element of my program that needs to access this Fragment class. When I go to build in eclipse I receive the following error message "This Fragment class should be public ....", why is this error generated?
"`private static class PlaceholderFragment extends ListFragment {...."`
因为Android框架可能需要通过反射来调用Fragment的no-arg构造函数,如果该类是私有的,它就无法执行。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.