Understanding Android Fragments: When and How to Use Them
Understanding Android Fragments: When and How to Use Them
Fragments are reusable UI components in Android. They represent a portion of the UI within an Activity.
Example:
public class MyFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_my, container, false);
}
}
Fragments allow you to create modular and flexible UIs.
Comments
Post a Comment