KIO
Kreative Ideen online
Fragments explaination

Fragments explaination

What if you want your app to look and behave differently depending on whether itÄs running on a phone or a tablet? In this case you need fragments, modular code components that can be reused by different activities.

So what’s a fragment?

Fragments are like reusable components or subactivities. A fragment is used to crontrol part of a screen, and can be reused between screens. This means we can create a fragment for the a list of workouts, and a fragment to display the details of a single workout. These fragments can then be shared between layouts.

A fragment has a layout

Jus like an activity, a fragment has an associated layout. If you design it carefully, the fragment’s Java code can be used to crotrol everything within the interface. If the fragment code contains all that you need to crontrol its layout, it greatly increases the chances that you’ll be able to resuse it elsewhere in the app.

Leave a Reply

Your email address will not be published. Required fields are marked *