@Override protected void onStop() { super.onStop(); if (udpSenderService != null && !udpSenderService.isRunning()) stopService(new Intent(this, UdpSenderService.class)); save(); }
public void error(final String text) { final Activity activity = this; new AlertDialog.Builder(activity) .setTitle("Error") .setMessage(text) .setNeutralButton("OK", null) .show(); if (udpSenderService != null) { udpSenderService.stop(); start.setChecked(false); txtIp.setEnabled(true); txtPort.setEnabled(true); chkSendOrientation.setEnabled(true); chkSendRaw.setEnabled(true); } }
@Override public void onServiceConnected(ComponentName componentName, IBinder iBinder) { udpSenderService = ((UdpSenderService.MyBinder) iBinder).getService(); start.setChecked(udpSenderService.isRunning()); }