Android: Play / Pause song on proximity sensor method -


is there way play , pause song using proximity sensor? wanted play song default state. when user waves hand on proximity sensor, should pause song till time waves again.

i have these code pause when in near / far state. start playing on far / near value. wanted make pause same event , play same event next time.

            if(event.values[0]==sensor.getmindelay()) or sensor.getmaximumrange()             {                    log.i("pause","pause");                 player.pause();                 textview.settext("pause");              }             else             {                    log.i("play","play");                 player.start();                 textview.settext("now playing..!");              } 

any / suggestions appreciated.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -