@Override public void onServiceConnected(ComponentName name, IBinder service) { traceService = ((TraceService.ServiceBinder) service).getService(); if (traceService.isStart()) { serviceToggleButton.setChecked(true); tracingAppTextView.setText("Trace: " + traceService.getTracingApp().getProcessName()); } else { serviceToggleButton.setChecked(false); } serviceToggleButton.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { traceService.start(); } else { traceService.stop(); } } }); }
public void setInterval(long interval) { if (traceService != null) { traceService.setInterval(interval); } }
public long getInterval() { if (traceService != null) { return traceService.getInterval(); } return 10000; }