Code example for FragmentManager

Methods: beginTransactionfindFragmentById

        FragmentManager fm = getSupportFragmentManager();
        // Create the list fragment and add it as our sole content. 
        if (fm.findFragmentById( == null) {
            TrackListFragment list = new TrackListFragment();
            fm.beginTransaction().add(, list).commit();
    // Utility class to store the View ID's retrieved from the layout only once for efficiency 
    static class TrackViewHolder { 
        TextView artist;
        TextView title;
        ImageView cover;
    // Custom list view item (cover image | artist/album text)