开发者

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

开发者 https://www.devze.com 2023-03-01 00:07 出处:网络
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?

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

精彩评论

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

关注公众号