public void onClick(View v) {
if(v.getId() == R.id.play_stop){
Intent intent = new Intent(this, MusicService.class);
intent.setAction(Constants.ACTION.PLAY_STOP_ACTION);
startService(intent);
}else if(v.getId() == R.id.next){
Intent intent = new Intent(this, MusicService.class);
intent.setAction(Constants.ACTION.NEXT_ACTION);
startService(intent);
}else if(v.getId() == R.id.prev){
Intent intent = new Intent(this, MusicService.class);
intent.setAction(Constants.ACTION.PREV_ACTION);
startService(intent);
}
else if(v.getId() == R.id.End){
Intent intent = new Intent(this, MusicService.class);
intent.setAction(Constants.ACTION.STOP_ACTION);
startService(intent);
}
}
이런식으로 Intent를 넘겨서 서비스에서 Action에 따라서 기능을 처리하도록 만들었는데요.
기능 자체는 잘 돌아가는데 혹시 이렇게 startService를 중복으로 사용하면 뭔가 문제가 생기나요? 고수님들 조언 부탁드립니다!!