java - Why instance a new fragment inside a public static class -
Reference:
I'm new to Java and Android and going through the online Android guide I am I have two questions:
Question 1: Why is there a need to create a new example of the description fragment within the public static class? Question 2: "Create a new example" further declares a new announcement. There are four places in total, where the same name is called "Descriptionfragment". It is very confusing please explain? It is called, and in this case you can easily create a new one Without knowing about the internal implementation, the example of the piece with all necessary logic required. For example, without this, to prepare the initial example of the piece properly, you will use it: Using a stable factory method, this logic is trusted only in the component, and you can use it only. :
The public static class explanation extends the Fragment Fragment {/ * Create a new instance of the description fragment, started to show text on 'Index'. * / Public static descriptionfragrage new instance (int index) {detailsfragragef = new statementfragration (); // Supply indicator input bundle arguments as a logic = new bundle (); Args.putInt ("index", index); F.setArguments (args); Return; }}
DescriptionFragment piece = new detailsFragment (); Bundle args = new bundle (); Args.putInt ("index", index); Fragment.setArguments (args); Use this piece, however, you need it
Description Fragments piece = Descriptionfragment.Newinstance (index); // then use slice
Comments
Post a Comment