Fragment

Android Fragment Lifecycle

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 …

Android Fragment Lifecycle Read More »

Fragment Example 1

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         android:id=“@+id/button1”         android:layout_width=“wrap_content”         android:layout_height=“wrap_content”         android:text=“Button” />     <fragment         android:id=“@+id/frag”         android:layout_width=“match_parent”         android:layout_height=“match_parent”         class=“com.blogspot.csdevbin.fragment.MainActivity$SSFFragment” /> </LinearLayout> hellofrag.xml <TextView    …

Fragment Example 1 Read More »