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

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

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

FragmentActivity.startService介绍

暂无

代码示例

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

private void doTheDownload() {
 b.setEnabled(false);
 Intent i=new Intent(getActivity(), Downloader.class);
 i.setData(Uri.parse("https://commonsware.com/Android/Android-1_0-CC.pdf"));
 getActivity().startService(i);
}

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

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

  i.setDataAndType(Uri.parse("http://commonsware.com/Android/Android-1_1-CC.pdf"),
           "application/pdf");

  getActivity().startService(i);
  getActivity().finish();
 }
}

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

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

  i.setDataAndType(Uri.parse("http://commonsware.com/Android/Android-1_1-CC.pdf"),
           "application/pdf");

  getActivity().startService(i);
  getActivity().finish();
 }
}

代码示例来源: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 void onClick(View v) {
  Intent i=new Intent(getActivity(), Downloader.class);

  i.setData(Uri.parse("https://commonsware.com/Android/excerpt.pdf"));

  getActivity().startService(i);
  getActivity().finish();
 }
}

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

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

  i.setDataAndType(Uri.parse("https://commonsware.com/Android/Android-1_0-CC.pdf"),
           "application/pdf");

  getActivity().startService(i);
  getActivity().finish();
 }
}

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

private void bluetoothReady() {
 isReady=true;
 if (isThing()) {
  getActivity().startService(new Intent(getActivity(),
   ShoutingEchoService.class));
  rxBluetooth.enableDiscoverability(getActivity(), REQUEST_ENABLE_DISCOVERY,
   300);
  Toast.makeText(getActivity(), R.string.msg_disco, Toast.LENGTH_LONG).show();
 }
 else {
  updateMenu();
  initAdapter();
  subs.add(rxBluetooth.observeDevices()
   .subscribeOn(Schedulers.io())
   .observeOn(AndroidSchedulers.mainThread())
   .subscribe(this::addDevice));
  subs.add(rxBluetooth.observeDiscovery()
   .subscribeOn(Schedulers.io())
   .observeOn(AndroidSchedulers.mainThread())
   .subscribe(s ->
    discover.setEnabled(!BluetoothAdapter.ACTION_DISCOVERY_STARTED.equals(s))));
 }
}

代码示例来源: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: julian-klode/dns66

private boolean startStopService() {
  if (AdVpnService.vpnStatus != AdVpnService.VPN_STATUS_STOPPED) {
    Log.i(TAG, "Attempting to disconnect");
    Intent intent = new Intent(getActivity(), AdVpnService.class);
    intent.putExtra("COMMAND", Command.STOP.ordinal());
    getActivity().startService(intent);
  } else {
    checkHostsFilesAndStartService();
  }
  return true;
}

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

getActivity().startService(intent);

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

@Override
public ComponentName startService(Intent service) {
  return super.startService(setPluginServiceFlag(service));
}

代码示例来源:origin: lx8421bcd/QuickDevFramework

@OnClick(R.id.btnShowTopDialog)
public void onShowTopDialogClick(View v) {
  Intent backServiceIntent = new Intent(getActivity(), BackgroundService.class);
  getActivity().startService(backServiceIntent);
}

代码示例来源:origin: nglauber/dominando_android2

@Override
  public void onRefresh() {
    Intent it = new Intent(getActivity(), HotelIntentService.class);
    getActivity().startService(it);
  }
}

代码示例来源:origin: nglauber/dominando_android2

@Override
  public void onRefresh() {
    Intent it = new Intent(getActivity(), HotelIntentService.class);
    getActivity().startService(it);
  }
}

代码示例来源:origin: openmrs/openmrs-contrib-android-client

@Override
public void startFormListService() {
  Intent i = new Intent(getContext(), FormListService.class);
  getActivity().startService(i);
}

代码示例来源:origin: nglauber/dominando_android2

@Override
  public void onRefresh() {
    Intent it = new Intent(getActivity(), HotelIntentService.class);
    getActivity().startService(it);
  }
}

代码示例来源:origin: EthACKdotOrg/orWall

@Override
  public void onClick(DialogInterface dialogInterface, int i) {
    bgpProcess.putExtra(Constants.ACTION, Constants.ACTION_DISABLE_ORWALL);
    getActivity().startService(bgpProcess);
    Preferences.setOrwallEnabled(getActivity(), false);
    updateOptions();
    notificationManager.notify(1, notification.build());
  }
});

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

@Override
public void onRefresh() {
  UIUtils.showRefreshAnimation(swipeRefreshLayout);
  Intent syncIntent = new Intent(this.getActivity(), LibrarySyncService.class);
  syncIntent.putExtra(getListSyncType(), true);
  String syncID = getSyncID();
  int itemId = getSyncItemID();
  if ((syncID != null) && (itemId != -1)) {
    syncIntent.putExtra(syncID, itemId);
  }
  getActivity().startService(syncIntent);
}

代码示例来源:origin: Ashish-Bansal/OneTapVideoDownload

@Override
public void onResume() {
  super.onResume();
  if (mBounded == null || !mBounded) {
    getActivity().startService(DownloadManager.getActionStartService());
    Intent mIntent = new Intent(getActivity(), DownloadManager.class);
    getActivity().bindService(mIntent, mConnection, Context.BIND_ABOVE_CLIENT);
  }
}

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

@Override
public void onStart() {
  super.onStart();
  if (playIntent == null) {
    playIntent = new Intent(getActivity(), MusicService.class);
    getActivity().bindService(playIntent, musicConnection, Context.BIND_AUTO_CREATE);
    getActivity().startService(playIntent);
  }
}

相关文章

微信公众号

最新文章

更多

FragmentActivity类方法