0

fragment android question

what does this mean? im reading a book on android when i saw this."All fragments must have a public no-argument constructor."why do we need this?

5th Dec 2017, 2:31 AM
oyl
1 Answer
0
I imagine because internally the fragments are (sometimes/often) created without being explicitly called, and the default constructor is needed to do this. But it has to follow the same access rules, so if you create another constructor this will mean there is no default no-argument constructor and the fragment will fail to be instantiated
6th Dec 2017, 10:13 AM
Dan Walker
Dan Walker - avatar