1

Code in fragment

In my fragment i check if my service was bound already or not, but how can i immediately call my second method when Main.bindMusicService(); is finished (after onServiceConnected gets called)?

Now i have to tap my song 2 times before it starts playing.

if (!Main.mServiceIsBound && getActivity() != null) {
    Main.bindMusicService(getActivity().getApplicationContext());
    Log.i(TAG,"Service is not bound yet!, binding Service...");
}

if (getActivity()!= null && Main.mServiceIsBound) {
    Main.mediaPlayerService.startActionPlay(getActivity().getApplicationContext(), songList, position);
}
Vince VD
  • 1,286
  • 10
  • 30

0 Answers0