java - How to add create playlist and play in mediaplayer in Android -


i beginner in android, not able understand 1 thing, hope guys can help.

i have been developing simple app plays music according music node entered in textbox. there 8-9 music files. so, whatever user enters in textbox, mediaplayer should play files. have have done part till gets sorted. totally blank on how implement mediaplayer in this. also, not able understand how put pause milli seconds on mediaplayer whenever user enter "." have stop button can stop mediaplayback going on don't understand media part completely. here's code, please me how implement it.

public class mainactivity extends appcompatactivity {  edittext nodes_edit; button play_btn, stop_btn;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     nodes_edit = (edittext) findviewbyid(r.id.edit_music);     play_btn = (button) findviewbyid(r.id.play_btn);     stop_btn = (button) findviewbyid(r.id.stop_btn);      play_btn.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {             string nodes = nodes_edit.gettext().tostring();             string[] music_words = nodes.split(" ");             int music_lenth = music_words.length;             arraylist<integer> raw = new arraylist<>();             (int i=0; i<music_lenth; i++){                 string a1 = "a1";                 string a1s = "a1s";                 string b1 = "b1";                 string c1 = "c1";                 string c1s = "c1s";                 string c2 = "c2";                 string d1 = "d1";                 string d1s = "d1s";                 string e1 = "e1s";                 string f1 = "f1";                 string f1s = "f1s";                 string g1 = "g1";                 string g1s = "g1s";                 string dot = ".";                 string doubledot = "..";                  if (music_words[i].equalsignorecase(a1)){                      raw.add(r.raw.a1);                  }else if (music_words[i].equalsignorecase(a1s)){                      raw.add(i,r.raw.a1s);                  } else if (music_words[i].equalsignorecase(b1)){                      raw.add(i,r.raw.b1);                  }else if (music_words[i].equalsignorecase(c1)){                      raw.add(i,r.raw.c1);                  }else if (music_words[i].equalsignorecase(c1s)){                      raw.add(i,r.raw.c1s);                  }else if (music_words[i].equalsignorecase(c2)){                      raw.add(i,r.raw.c2);                  }else if (music_words[i].equalsignorecase(d1)){                      raw.add(i,r.raw.d1);                  }else if (music_words[i].equalsignorecase(d1s)){                      raw.add(i,r.raw.d1s);                 }else if (music_words[i].equalsignorecase(e1)){                      raw.add(i,r.raw.e1);                  }else if (music_words[i].equalsignorecase(f1)){                      raw.add(i,r.raw.f1);                  }else if (music_words[i].equalsignorecase(f1s)){                      raw.add(i,r.raw.f1s);                  }else if (music_words[i].equalsignorecase(g1)){                      raw.add(i,r.raw.g1);                  }else if (music_words[i].equalsignorecase(g1s)){                      raw.add(i,r.raw.g1s);                  }else if (music_words[i].equalsignorecase(dot)){                  }else if (music_words[i].equalsignorecase(doubledot)){                  }             }         }     });      stop_btn.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {          }     }); } 

please code , explanation.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -