Skip to content

Instantly share code, notes, and snippets.

View developersamuelakram's full-sized avatar

Developer Sam developersamuelakram

View GitHub Profile
@developersamuelakram
developersamuelakram / gist:bc620cfe15ddff85bcbc750a3ea1fa52
Created May 22, 2020 04:10
Using Index position for next or prev songs in MediaPlayer Class
Hi I have been feeling very overwhelmed and discouraged I am stuck. I want to have more than one song in my music player and add next and prev buttons. Can it be done with using an ArrayList of songs and then using the index position? Can someone write a small code snippet to modify my code below and tell me how to add prev and next button. I was hoping if everytime next is clicked index position is incremented thus causing the next element of arraylist to start.
My XML CODE :
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:id="@+id/play"
android:text="Play" />