kanytu / android-material-drawer-template

An Android template with navigation drawer for material design
Apache License 2.0
674 stars 217 forks source link

missing constructor for NavigationDrawerFragment() #13

Closed cpoole closed 9 years ago

cpoole commented 9 years ago

The NavigationDrawerFragment class is missing an empty constructor as required by the API "All subclasses of Fragment must include a public no-argument constructor. The framework will often re-instantiate a fragment class when needed, in particular during state restore, and needs to be able to find this constructor to instantiate it. If the no-argument constructor is not available, a runtime exception will occur in some cases during state restore." http://developer.android.com/reference/android/app/Fragment.html

I personally havent had any problems but rather safe than sorry.

Great work btw!

kanytu commented 9 years ago

In the absence of explicit constructors, however, the compiler provides a public, parameterless default constructor.

From Effective Java. Page 19

Therefor, since there is no construtor on the class the compiler will create an empty one. No need to manually add one.