@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_control, container, false);
    mListener = (ControlFragmentListener) getActivity();
    mHelper.setListeners(getActivity());

    mControlButton = (ImageButton) view.findViewById(R.id.button_control_service);
    mControlButton.setOnClickListener(mButtonListener);

    mCurrentPathButton = (ImageButton) view.findViewById(R.id.button_show_current);
    mCurrentPathButton.setOnClickListener(mCurrentButtonListener);

    mClearButton = (ImageButton) view.findViewById(R.id.button_clear);
    mClearButton.setOnClickListener(mClearButtonListener);

    mSaveButton = (ImageButton) view.findViewById(R.id.button_save);
    mSaveButton.setOnClickListener(mSaveButtonListener);

    mInfoButton = (ImageButton) view.findViewById(R.id.button_info);
    mInfoButton.setOnClickListener(mInfoButtonListener);

    changeButtonIcon(mHelper.isServiceStarted());
    mHelper.getList();
    return view;
  }
 @Override
 public void onCreate(Bundle savedInstancceState) {
   super.onCreate(savedInstancceState);
   mHelper = MapHelper.getInstance(getActivity().getApplicationContext());
   setRetainInstance(true);
 }
 @Override
 public void onClick(View v) {
   mListener.onCurrentButtonClick();
   mHelper.getList();
 }
 @Override
 public void onClick(View v) {
   mListener.onClearButtonClick();
   if (mHelper.isServiceStarted()) mHelper.clearData();
 }
 @Override
 public void onClick(View v) {
   Log.i(TAG, "onClick " + mHelper.isServiceStarted());
   if (mHelper.isServiceStarted()) mHelper.stopService();
   else mHelper.startService();
 }
 public void deletePath(MapPath path) {
   mHelper.deletePath(path);
 }
 public void updatePath(MapPath path, String newName) {
   mHelper.updatePath(path, newName);
 }
 public void clearData() {
   mHelper.clearData();
 }
 public void saveToDatabase(String name, double distance, double avgSpeed) {
   mHelper.saveToDatabase(name, distance, avgSpeed);
 }