Can I create an array of song and use the shuffle() method for it? [duplicate]











up vote
0
down vote

favorite













This question already has an answer here:




  • Random shuffling of an array

    25 answers




Hi can I have and array of int music = {R.raw.song1, R.raw.song2}
and use the music.shuffle() ? so that I will put this method in the next button for it to shuffles to a random songs ?










share|improve this question













marked as duplicate by ישו אוהב אותך, Community Nov 21 at 22:16


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















    up vote
    0
    down vote

    favorite













    This question already has an answer here:




    • Random shuffling of an array

      25 answers




    Hi can I have and array of int music = {R.raw.song1, R.raw.song2}
    and use the music.shuffle() ? so that I will put this method in the next button for it to shuffles to a random songs ?










    share|improve this question













    marked as duplicate by ישו אוהב אותך, Community Nov 21 at 22:16


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite












      This question already has an answer here:




      • Random shuffling of an array

        25 answers




      Hi can I have and array of int music = {R.raw.song1, R.raw.song2}
      and use the music.shuffle() ? so that I will put this method in the next button for it to shuffles to a random songs ?










      share|improve this question














      This question already has an answer here:




      • Random shuffling of an array

        25 answers




      Hi can I have and array of int music = {R.raw.song1, R.raw.song2}
      and use the music.shuffle() ? so that I will put this method in the next button for it to shuffles to a random songs ?





      This question already has an answer here:




      • Random shuffling of an array

        25 answers








      android android-studio






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 at 22:55









      BeAmazedVariable

      63




      63




      marked as duplicate by ישו אוהב אותך, Community Nov 21 at 22:16


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






      marked as duplicate by ישו אוהב אותך, Community Nov 21 at 22:16


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          hope this helps



          private int getRandomSong(int  music) {
          int max = music.length - 1;
          int min = 0;
          int random = (new Random()).nextInt((max - min) + 1) + min;
          return music[random];
          }


          happy coding :)



          next time try to give a bit more information about the question else you will get down votes unnecessarily :)






          share|improve this answer




























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote



            accepted










            hope this helps



            private int getRandomSong(int  music) {
            int max = music.length - 1;
            int min = 0;
            int random = (new Random()).nextInt((max - min) + 1) + min;
            return music[random];
            }


            happy coding :)



            next time try to give a bit more information about the question else you will get down votes unnecessarily :)






            share|improve this answer

























              up vote
              0
              down vote



              accepted










              hope this helps



              private int getRandomSong(int  music) {
              int max = music.length - 1;
              int min = 0;
              int random = (new Random()).nextInt((max - min) + 1) + min;
              return music[random];
              }


              happy coding :)



              next time try to give a bit more information about the question else you will get down votes unnecessarily :)






              share|improve this answer























                up vote
                0
                down vote



                accepted







                up vote
                0
                down vote



                accepted






                hope this helps



                private int getRandomSong(int  music) {
                int max = music.length - 1;
                int min = 0;
                int random = (new Random()).nextInt((max - min) + 1) + min;
                return music[random];
                }


                happy coding :)



                next time try to give a bit more information about the question else you will get down votes unnecessarily :)






                share|improve this answer












                hope this helps



                private int getRandomSong(int  music) {
                int max = music.length - 1;
                int min = 0;
                int random = (new Random()).nextInt((max - min) + 1) + min;
                return music[random];
                }


                happy coding :)



                next time try to give a bit more information about the question else you will get down votes unnecessarily :)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 14 at 23:02









                Har Kal

                590314




                590314















                    Popular posts from this blog

                    How to send String Array data to Server using php in android

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                    Is anime1.com a legal site for watching anime?