开发者

How to alternate between startService() and stopService() using onClick?

How do i alternate between this two intents on a surfaceview and create the sort of graphical effect seen in youtube during start/pause when recording a video?

-->stopService(new Intent(getApplicationContext(), ServiceRecording.c开发者_JAVA百科lass)); -->startService(new Intent(getApplicationContext(), ServiceRecording.class);

public void onClick(View v)
            {

            }


Is there some reason why the following idea won't work?

if (serviceRunning) {
  serviceRunning = false;
  stopService(...);
} else {
  serviceRunning = true;
  startService(...);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜