android.support.v4.app.FragmentActivity.stopService()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中android.support.v4.app.FragmentActivity.stopService()方法的一些代码示例,展示了FragmentActivity.stopService()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FragmentActivity.stopService()方法的具体详情如下:
包路径:android.support.v4.app.FragmentActivity
类名称:FragmentActivity
方法名:stopService

FragmentActivity.stopService介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onClick(View v) {
  Intent i=new Intent(getActivity(), PlayerService.class);

  if (v.getId() == R.id.start) {
   i.putExtra(PlayerService.EXTRA_PLAYLIST, "main");
   i.putExtra(PlayerService.EXTRA_SHUFFLE, true);

   getActivity().startService(i);
  }
  else {
   getActivity().stopService(i);
  }
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onOptionsItemSelected(MenuItem item) {
 switch (item.getItemId()) {
  case R.id.server:
   if (isServerRunning()) {
    getActivity().stopService(new Intent(getActivity(),
     ShoutingEchoService.class));
   }
   else {
    getActivity().startService(new Intent(getActivity(),
     ShoutingEchoService.class));
   }
   return(true);
  case R.id.discover:
   rxBluetooth.startDiscovery();
   return(true);
  case R.id.allow_disco:
   rxBluetooth.enableDiscoverability(getActivity(), REQUEST_ENABLE_DISCOVERY);
   return(true);
 }
 return(super.onOptionsItemSelected(item));
}

代码示例来源:origin: dkim0419/SoundRecorder

mRecordingPrompt.setText(getString(R.string.record_prompt));
getActivity().stopService(intent);

代码示例来源:origin: ManbangGroup/Phantom

@Override
public boolean stopService(Intent name) {
  return super.stopService(setPluginServiceFlag(name));
}

代码示例来源:origin: AnandChowdhary/saga-android

@Override
public void onDestroy() {
  getActivity().stopService(playIntent);
  musicSrv = null;
  super.onDestroy();
}

代码示例来源:origin: wallabag/android-app

@Override
public void onDestroyView() {
  //Log.d(LOG_TAG, "onDestroyView");
  super.onDestroyView();
  if (ttsService != null) {
    getActivity().unbindService(serviceConnection);
    if (!dontStopTtsService) {
      Intent intent = new Intent(getContext(), TtsService.class);
      getActivity().stopService(intent);
    }
  }
  serviceConnection = null;
}

代码示例来源:origin: HelloChenJinJun/TestChat

@Override
public void onDestroyView() {
    super.onDestroyView();
    if (getActivity() != null) {
        getActivity().stopService(intent);
    }
}

代码示例来源:origin: byhieg/easyweather

@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
  SharedPreferences settings = getActivity().getSharedPreferences(fileName, Context.MODE_PRIVATE);
  SharedPreferences.Editor edit = settings.edit();
  edit.putBoolean("ischecked", isChecked);
  edit.apply();
  if (isChecked) {
    if (flag == 2) {
      getActivity().startService(new Intent(getActivity(), NotificationService.class));
    }
  }else{
    if (flag == 2) {
      getActivity().stopService(new Intent(getActivity(), NotificationService.class));
    }
  }
}

代码示例来源:origin: xbmc/Kore

LogUtils.LOGD(TAG, "Stoping connection observer service");
Intent intent = new Intent(getActivity(), ConnectionObserversManagerService.class);
getActivity().stopService(intent);
if (sharedPreferences.getBoolean(Settings.KEY_PREF_SHOW_NOTIFICATION, Settings.DEFAULT_PREF_SHOW_NOTIFICATION)) {
  if (Utils.isOreoOrLater()) {

代码示例来源:origin: casific/murmur

SecurityManager.setStoredMAC(getActivity(), mac);
Intent intent = new Intent(getActivity(), MurmurService.class);
getActivity().stopService(intent);
getActivity().startService(intent);
reload = false;

相关文章

微信公众号

最新文章

更多

FragmentActivity类方法