Posts
Here is the list of methods which you can to override in your fragment class − onAttach() The fragment instance is associated with an activity instance.The fragment and the activity is not fully initialized. Typically you get in this method a reference to the activity which uses the fragment for further initialization work. onCreate() The system calls this method when creating the fragment. You should initialize essential components of the fragment that you want to retain when the fragment is paused or stopped, then resumed. onCreateView() The system calls this callback when it's time for the fragment to draw its user interface for the first time. To draw a UI for your fragment, you must return a View component from this method that is the root of your fragment's layout. You can return null if the fragment does not provide a UI. onActivityCreated() The onActivityCreated() is called after the onCreateView() method when the host activity is cre...
MainActivity.xml < LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" xmlns: tools = "http://schemas.android.com/tools" android :id= "@+id/LinearLayout1" android :layout_width= "match_parent" android :layout_height= "match_parent" android :orientation= "vertical" tools :context= ".MainActivity" > < TextView android :id= "@+id/textView1" android :layout_width= "wrap_content" android :layout_height= "wrap_content" android :text= "Large Text" android :textAppearance= "?android:attr/textAppearanceLarge" /> < Button ...