Music Player(LetsPlay) Source Code for MarPoint

 LetsPlay is Music App for android. Here i am sharing source code.

Mainfest.

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.example.letsplay">
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <application        android:allowBackup="true"        android:icon="@mipmap/ic_launcher"        android:label="@string/app_name"        android:roundIcon="@mipmap/ic_launcher_round"        android:supportsRtl="true"        android:theme="@style/AppTheme">        <activity android:name=".CurrentList"></activity>        <activity android:name=".Player" />        <activity android:name=".MainActivity">            <intent-filter>                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>        </activity>    </application>
</manifest>

Java Files

Album.java

package com.example.letsplay;

import android.os.Bundle;import android.support.v4.app.Fragment;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;

/** * A simple {@link Fragment} subclass. */public class Album extends Fragment {


    public Album() {
        // Required empty public constructor    }


    @Override    public View onCreateView(LayoutInflater inflater, ViewGroup container,                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment        return inflater.inflate(R.layout.fragment_album, container, false);    }

}

Player.java

package com.example.letsplay;
import android.annotation.SuppressLint;import android.content.Intent;import android.media.MediaPlayer;import android.net.Uri;import android.os.Handler;import android.os.Message;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.util.Log;import android.view.View;import android.widget.Button;import android.widget.ImageView;import android.widget.SeekBar;import android.widget.TextView;import android.widget.Toast;
import java.io.File;import java.util.ArrayList;
public class Player extends AppCompatActivity {
    SeekBar mSeekBar;    TextView songTitle;    ArrayList<File> allSongs;    static MediaPlayer mMediaPlayer;    int position;    TextView curTime;    TextView totTime;    ImageView playIcon;    ImageView prevIcon;    ImageView nextIcon;    Intent playerData;    Bundle bundle;    ImageView repeatIcon;    ImageView suffleIcon;    ImageView curListIcon;

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_player);
        mSeekBar = findViewById(R.id.mSeekBar);        songTitle = findViewById(R.id.songTitle);        curTime = findViewById(R.id.curTime);        totTime = findViewById(R.id.totalTime);
        playIcon = findViewById(R.id.playIcon);        prevIcon = findViewById(R.id.prevIcon);        nextIcon = findViewById(R.id.nextIcon);
        repeatIcon = findViewById(R.id.repeatIcon);        suffleIcon = findViewById(R.id.suffleIcon);        curListIcon = findViewById(R.id.curListIcon);

        if (mMediaPlayer != null) {
            mMediaPlayer.stop();        }

        playerData = getIntent();        bundle = playerData.getExtras();
        allSongs = (ArrayList) bundle.getParcelableArrayList("songs");        position = bundle.getInt("position", 0);        initPlayer(position);
        curListIcon.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View v) {
                Intent list = new Intent(getApplicationContext(),CurrentList.class);                list.putExtra("songsList",allSongs);                startActivity(list);
            }
        });

        playIcon.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View v) {
                play();            }
        });        prevIcon.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View v) {

                if (position <= 0) {
                    position = allSongs.size() - 1;                } else {
                    position--;                }

                initPlayer(position);
            }
        });
        nextIcon.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View v) {
                if (position < allSongs.size() - 1) {
                    position++;                } else {
                    position = 0;
                }
                initPlayer(position);            }
        });
    }


    private void initPlayer(final int position) {

        if (mMediaPlayer != null && mMediaPlayer.isPlaying()) {
            mMediaPlayer.reset();        }

        String sname = allSongs.get(position).getName().replace(".mp3", "").replace(".m4a", "").replace(".wav", "").replace(".m4b", "");        songTitle.setText(sname);        Uri songResourceUri = Uri.parse(allSongs.get(position).toString());
        mMediaPlayer = MediaPlayer.create(getApplicationContext(), songResourceUri); // create and load mediaplayer with song resources        mMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override            public void onPrepared(MediaPlayer mp) {
                String totalTime = createTimeLabel(mMediaPlayer.getDuration());                totTime.setText(totalTime);                mSeekBar.setMax(mMediaPlayer.getDuration());                mMediaPlayer.start();                playIcon.setImageResource(R.drawable.ic_pause_black_24dp);
            }
        });
        mMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override            public void onCompletion(MediaPlayer mp) {
                int curSongPoition = position;                // code to repeat songs until the                if (curSongPoition < allSongs.size() - 1) {
                    curSongPoition++;                    initPlayer(curSongPoition);                } else {
                    curSongPoition = 0;                    initPlayer(curSongPoition);                }

                //playIcon.setImageResource(R.drawable.ic_play_arrow_black_24dp);
            }
        });

        mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {

                if (fromUser) {
                    mMediaPlayer.seekTo(progress);                    mSeekBar.setProgress(progress);                }

            }

            @Override            public void onStartTrackingTouch(SeekBar seekBar) {

            }

            @Override            public void onStopTrackingTouch(SeekBar seekBar) {

            }
        });

        new Thread(new Runnable() {
            @Override            public void run() {
                while (mMediaPlayer != null) {
                    try {
//                        Log.i("Thread ", "Thread Called");                        // create new message to send to handler                        if (mMediaPlayer.isPlaying()) {
                            Message msg = new Message();                            msg.what = mMediaPlayer.getCurrentPosition();                            handler.sendMessage(msg);                            Thread.sleep(1000);                        }
                    } catch (InterruptedException e) {
                        e.printStackTrace();                    }
                }
            }
        }).start();    }

    @SuppressLint("HandlerLeak")
    private Handler handler = new Handler() {
        @Override        public void handleMessage(Message msg) {
//            Log.i("handler ", "handler called");            int current_position = msg.what;            mSeekBar.setProgress(current_position);            String cTime = createTimeLabel(current_position);            curTime.setText(cTime);        }
    };

    private void play() {

        if (mMediaPlayer != null && !mMediaPlayer.isPlaying()) {
            mMediaPlayer.start();            playIcon.setImageResource(R.drawable.ic_pause_black_24dp);        } else {
            pause();        }

    }

    private void pause() {
        if (mMediaPlayer.isPlaying()) {
            mMediaPlayer.pause();            playIcon.setImageResource(R.drawable.ic_play_arrow_black_24dp);
        }

    }




    public String createTimeLabel(int duration) {
        String timeLabel = "";        int min = duration / 1000 / 60;        int sec = duration / 1000 % 60;
        timeLabel += min + ":";        if (sec < 10) timeLabel += "0";        timeLabel += sec;
        return timeLabel;

    }
}

Music.java

import android.Manifest;import android.content.Intent;import android.os.Bundle;import android.os.Environment;import android.support.v4.app.Fragment;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.AdapterView;import android.widget.ArrayAdapter;import android.widget.ListView;
import com.karumi.dexter.Dexter;import com.karumi.dexter.PermissionToken;import com.karumi.dexter.listener.PermissionDeniedResponse;import com.karumi.dexter.listener.PermissionGrantedResponse;import com.karumi.dexter.listener.PermissionRequest;import com.karumi.dexter.listener.single.PermissionListener;
import java.io.File;import java.util.ArrayList;

/** * A simple {@link Fragment} subclass. */public class Music extends Fragment {

    ListView mListView;    ArrayList<String> musics;    ArrayAdapter<String> mArrayAdapter;    String[] songs;

    public Music() {
        // Required empty public constructor    }


    @Override    public View onCreateView(LayoutInflater inflater, ViewGroup container,                             Bundle savedInstanceState) {

        // to display menu in action bar        //setHasOptionsMenu(true);
        // Inflate the layout for this fragment        View view =  inflater.inflate(R.layout.fragment_music, container, false);        mListView = view.findViewById(R.id.musicListView);
        askStoragePermissions();
        return view;    }

    public ArrayList<File> findMusics(File file){

        ArrayList<File> musicLists = new ArrayList<File>();
        File[] files = file.listFiles();
        for(File singleFile: files ){
            if(singleFile.isDirectory() && !singleFile.isHidden()){
                musicLists.addAll(findMusics(singleFile));            }else{
                if(singleFile.getName().endsWith(".mp3") || singleFile.getName().endsWith(".m4a") || singleFile.getName().endsWith(".wav") || singleFile.getName().endsWith(".m4b")){
                    musicLists.add(singleFile);                }
            }
        }

        return musicLists;
    }

    public void display(){

        final ArrayList<File> allSongs = findMusics(Environment.getExternalStorageDirectory());        songs = new String[allSongs.size()];
        for(int i=0;i<allSongs.size();i++){
            songs[i] = allSongs.get(i).getName().replace(".mp3","").replace(".m4a","").replace(".wav","").replace(".m4b","");        }


        mArrayAdapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,songs);        mListView.setAdapter(mArrayAdapter);
        mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                // start music player when song name is clicked
                String songName = mListView.getItemAtPosition(position).toString();                Intent play = new Intent(getActivity(),Player.class);                play.putExtra("songs",allSongs).putExtra("songName",songName).putExtra("position",position);                startActivity(play);            }
        });
    }

    public void askStoragePermissions(){
        Dexter.withActivity(getActivity()).withPermission(Manifest.permission.READ_EXTERNAL_STORAGE).withListener(new PermissionListener() {
            @Override            public void onPermissionGranted(PermissionGrantedResponse response) {
                display();            }

            @Override            public void onPermissionDenied(PermissionDeniedResponse response) {

            }

            @Override            public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {
                    token.continuePermissionRequest();            }
        }).check();    }

}

PageAdapter.java

package com.example.letsplay;
import android.support.v4.app.Fragment;import android.support.v4.app.FragmentManager;import android.support.v4.app.FragmentPagerAdapter;
public class PagerAdapter extends FragmentPagerAdapter {
    private int numOfTabs;
    public PagerAdapter(FragmentManager fm,int numOfTabs) {
        super(fm);        this.numOfTabs = numOfTabs;    }

    @Override    public Fragment getItem(int i) {
        switch (i){
            case 0:
                return new Music();            case 1:
                return new Album();            case 2:
                return new Playlist();                default:
                    return null;        }
    }

    @Override    public int getCount() {
        return numOfTabs;    }
}

Playlist.java


import android.os.Bundle;import android.support.v4.app.Fragment;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;

/** * A simple {@link Fragment} subclass. */public class Playlist extends Fragment {


    public Playlist() {
        // Required empty public constructor    }


    @Override    public View onCreateView(LayoutInflater inflater, ViewGroup container,                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment        return inflater.inflate(R.layout.fragment_playlist, container, false);    }

}

MainActivity.java

package com.example.letsplay;
import android.os.Bundle;import android.support.design.widget.TabItem;import android.support.design.widget.TabLayout;import android.support.v4.view.ViewPager;import android.support.v7.app.AppCompatActivity;import android.support.v7.widget.Toolbar;import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
    Toolbar mToolbar;    PagerAdapter mPagerAdapter;    TabLayout mTabLayout;    TabItem musicTabItem;    TabItem albumTabItem;    TabItem playlistTabItem;    ViewPager mViewPager;


    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);        mToolbar = findViewById(R.id.toolbar);        setSupportActionBar(mToolbar);        getSupportActionBar().setTitle(getString(R.string.app_name));
        mTabLayout = findViewById(R.id.tabLayout);        musicTabItem = findViewById(R.id.musicTabItem);        albumTabItem = findViewById(R.id.albumTabItem);        playlistTabItem = findViewById(R.id.playlistTabItem);        mViewPager = findViewById(R.id.pager);
        mPagerAdapter = new PagerAdapter(getSupportFragmentManager(),mTabLayout.getTabCount()); // call the pager class        mViewPager.setAdapter(mPagerAdapter); // set adapter for pager
        // do something when the tab is selected        mTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {

            @Override            public void onTabSelected(TabLayout.Tab tab) {
                mViewPager.setCurrentItem(tab.getPosition()); // set current tab position
                if(tab.getPosition() == 1){
//                    Toast.makeText(MainActivity.this, "Album Tab Selected.", Toast.LENGTH_SHORT).show();                }else if(tab.getPosition() == 2){
//                    Toast.makeText(MainActivity.this, "Music Tab Selected.", Toast.LENGTH_SHORT).show();                }else {
//                    Toast.makeText(MainActivity.this, "Playlist Tab Selected.", Toast.LENGTH_SHORT).show();                }

            }

            @Override            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override            public void onTabReselected(TabLayout.Tab tab) {

            }
        });
        mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mTabLayout));




    }


}

CurrentList.java

package com.example.letsplay;
import android.content.Intent;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.support.v7.widget.Toolbar;import android.util.Log;import android.widget.ArrayAdapter;import android.widget.ListView;
import java.io.File;import java.util.ArrayList;

public class CurrentList extends AppCompatActivity {
    Toolbar mListToolbar;    ArrayList<File> currentSongs;    ListView mListView;    String songs[];    ArrayAdapter<String> mArrayAdapter;
    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_current_list);        mListToolbar = findViewById(R.id.mListToolbar);        setSupportActionBar(mListToolbar);        getSupportActionBar().setTitle("Now Playing");        mListView = findViewById(R.id.currentList);
        Intent songData = getIntent();        currentSongs = (ArrayList) songData.getParcelableArrayListExtra("songsList");        songs = new String[currentSongs.size()];
        for(int i = 0; i < currentSongs.size();i++){
            songs[i] = currentSongs.get(i).getName().replace(".mp3","").replace(".m4a","").replace(".wav","").replace(".m4b","");            Log.i("Song Name: ",currentSongs.get(i).getName());        }

        mArrayAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,songs);        mListView.setAdapter(mArrayAdapter);


    }
}

Now Layout Files

activity_current_list.xml

<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".CurrentList">
    <android.support.v7.widget.Toolbar        android:id="@+id/mListToolbar"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:background="@color/colorPrimary"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toTopOf="parent" />
    <ListView        android:id="@+id/currentList"        android:layout_width="0dp"        android:layout_height="0dp"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/mListToolbar" />
</android.support.constraint.ConstraintLayout>


activity_main.xml

<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".MainActivity">
    <android.support.v7.widget.Toolbar        android:id="@+id/toolbar"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:background="@color/colorPrimary"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toTopOf="parent"        app:titleTextColor="#fff"/>
    <android.support.design.widget.TabLayout        android:id="@+id/tabLayout"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:background="@color/colorPrimary"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/toolbar"        app:tabSelectedTextColor="#fff">        <android.support.design.widget.TabItem            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:id="@+id/musicTabItem"            android:icon="@drawable/ic_audiotrack_black_24dp"/>        <android.support.design.widget.TabItem            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:id="@+id/albumTabItem"            android:icon="@drawable/ic_album_black_24dp"/>        <android.support.design.widget.TabItem            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:id="@+id/playlistTabItem"            android:icon="@drawable/ic_queue_music_black_24dp"/>
    </android.support.design.widget.TabLayout>
    <android.support.v4.view.ViewPager        android:id="@+id/pager"        android:layout_width="0dp"        android:layout_height="0dp"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/tabLayout">
    </android.support.v4.view.ViewPager>



</android.support.constraint.ConstraintLayout>

activity_player.xml

<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".Player">
    <ImageView        android:id="@+id/imageView"        android:layout_width="290dp"        android:layout_height="253dp"        android:layout_marginTop="24dp"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toTopOf="parent"        app:srcCompat="@drawable/music" />
    <TextView        android:id="@+id/songTitle"        android:layout_width="0dp"        android:layout_height="wrap_content"        android:layout_marginStart="24dp"        android:layout_marginLeft="24dp"        android:layout_marginTop="24dp"        android:layout_marginEnd="24dp"        android:layout_marginRight="24dp"        android:gravity="center"        android:text="TextView"        android:textColor="@color/design_default_color_primary_dark"        android:textSize="18sp"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintHorizontal_bias="0.5"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/imageView" />
    <SeekBar        android:id="@+id/mSeekBar"        android:layout_width="0dp"        android:layout_height="wrap_content"        android:layout_marginStart="8dp"        android:layout_marginLeft="8dp"        android:layout_marginTop="92dp"        android:layout_marginEnd="8dp"        android:layout_marginRight="8dp"        app:layout_constraintBottom_toTopOf="@+id/playIcon"        app:layout_constraintEnd_toStartOf="@+id/totalTime"        app:layout_constraintHorizontal_bias="0.5"        app:layout_constraintStart_toEndOf="@+id/curTime"        app:layout_constraintTop_toBottomOf="@+id/songTitle"        app:layout_constraintVertical_bias="0.59000003" />
    <TextView        android:id="@+id/curTime"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginStart="16dp"        android:layout_marginLeft="16dp"        android:text="00:00"        app:layout_constraintBottom_toBottomOf="@+id/mSeekBar"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toTopOf="@+id/mSeekBar" />
    <TextView        android:id="@+id/totalTime"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginEnd="8dp"        android:layout_marginRight="8dp"        android:text="05:00"        app:layout_constraintBottom_toBottomOf="@+id/mSeekBar"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintTop_toTopOf="@+id/mSeekBar" />
    <ImageView        android:id="@+id/playIcon"        android:layout_width="80dp"        android:layout_height="80dp"        android:src="@drawable/ic_play_arrow_black_24dp"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintEnd_toStartOf="@+id/nextIcon"        app:layout_constraintHorizontal_bias="0.5"        app:layout_constraintStart_toEndOf="@+id/prevIcon"        app:layout_constraintTop_toBottomOf="@+id/mSeekBar" />
    <ImageView        android:id="@+id/prevIcon"        android:layout_width="50dp"        android:layout_height="50dp"        android:contentDescription="TODO"        android:src="@drawable/ic_skip_previous_black_24dp"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintEnd_toStartOf="@+id/playIcon"        app:layout_constraintHorizontal_bias="0.5"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/mSeekBar" />
    <ImageView        android:id="@+id/nextIcon"        android:layout_width="50dp"        android:layout_height="50dp"        android:src="@drawable/ic_skip_next_black_24dp"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintHorizontal_bias="0.5"        app:layout_constraintStart_toEndOf="@+id/playIcon"        app:layout_constraintTop_toBottomOf="@+id/mSeekBar" />
    <ImageView        android:id="@+id/repeatIcon"        android:layout_width="40dp"        android:layout_height="40dp"        android:layout_marginStart="68dp"        android:layout_marginLeft="68dp"        android:layout_marginTop="8dp"        android:layout_marginBottom="8dp"        android:src="@drawable/repeat_default"        app:layout_constraintBottom_toTopOf="@+id/mSeekBar"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toBottomOf="@+id/songTitle"        app:layout_constraintVertical_bias="0.824" />
    <ImageView        android:id="@+id/suffleIcon"        android:layout_width="40dp"        android:layout_height="40dp"        android:layout_marginStart="8dp"        android:layout_marginLeft="8dp"        android:layout_marginTop="76dp"        android:layout_marginEnd="8dp"        android:layout_marginRight="8dp"        android:layout_marginBottom="16dp"        android:src="@drawable/suffle_default"        app:layout_constraintBottom_toTopOf="@+id/mSeekBar"        app:layout_constraintEnd_toStartOf="@+id/curListIcon"        app:layout_constraintStart_toEndOf="@+id/repeatIcon"        app:layout_constraintTop_toBottomOf="@+id/songTitle"        app:layout_constraintVertical_bias="0.656" />
    <ImageView        android:id="@+id/curListIcon"        android:layout_width="40dp"        android:layout_height="40dp"        android:layout_marginTop="8dp"        android:layout_marginEnd="64dp"        android:layout_marginRight="64dp"        android:layout_marginBottom="8dp"        android:src="@drawable/current_list"        app:layout_constraintBottom_toTopOf="@+id/mSeekBar"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintTop_toBottomOf="@+id/songTitle"        app:layout_constraintVertical_bias="0.824" /></android.support.constraint.ConstraintLayout>

fragment_album.xml

<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".Album">
    
    <TextView        android:layout_width="match_parent"        android:layout_height="match_parent"        android:text="@string/hello_blank_fragment" />
</FrameLayout>


fragment_music.xml

<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".Music">
   <ListView       android:layout_width="match_parent"       android:layout_height="wrap_content"       android:id="@+id/musicListView"/>
</FrameLayout>

fragment_playlist.xml

<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".Playlist">
    
    <TextView        android:layout_width="match_parent"        android:layout_height="match_parent"        android:text="@string/hello_blank_fragment" />
</FrameLayout>

Gradle Files

dependencies

dependencies {    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'    implementation 'com.android.support:design:28.0.0'    implementation 'com.android.support.constraint:constraint-layout:1.1.3'    implementation 'com.android.support:support-v4:28.0.0'    testImplementation 'junit:junit:4.12'    androidTestImplementation 'com.android.support.test:runner:1.0.2'    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'    implementation 'com.karumi:dexter:5.0.0'}

Download the App : Download now

Comments