AnaelMobilia / NextINpact-Unofficial

Application Android "NextINpact (Unofficial)"
GNU General Public License v3.0
16 stars 4 forks source link

Fragment - constructor #201

Closed AnaelMobilia closed 8 years ago

AnaelMobilia commented 8 years ago

Task has not declared any outputs.

/home/travis/build/AnaelMobilia/NextINpact-Unofficial/app/src/main/java/com/pcinpact/ArticleFragment.java:43: Error: This fragment should provide a default constructor (a public constructor with no arguments) (com.pcinpact.ArticleFragment) [ValidFragment]

public class ArticleFragment extends Fragment {

         ~~~~~~~~~~~~~~~

/home/travis/build/AnaelMobilia/NextINpact-Unofficial/app/src/main/java/com/pcinpact/ArticleFragment.java:48: Error: Avoid non-default constructors in fragments: use a default constructor plus Fragment#setArguments(Bundle) instead [ValidFragment]

public ArticleFragment(Context unContext, LayoutInflater unLayoutInflater, int articleID) {

       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Explanation for issues of type "ValidFragment":

From the Fragment documentation:

Every fragment must have an empty constructor, so it can be instantiated

when restoring its activity's state. It is strongly recommended that

subclasses do not have other constructors with parameters, since these

constructors will not be called when the fragment is re-instantiated;

instead, arguments can be supplied by the caller with setArguments(Bundle)

and later retrieved by the Fragment with getArguments().

http://developer.android.com/reference/android/app/Fragment.html#Fragment()

2 errors, 0 warnings