Remove the crime and stay in the fragment crime

How to remove a crime and update the adapter without returning to the list of crimes?

public class CrimeFragment extends Fragment {
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.fragment_crime, menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.delete_crime:
            CrimeLab.get(getActivity()).deleteCrime(mCrime);
            // getActivity().finish(); ------------? Adapter
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}

}

Hey,

I think, you are removing the crime by the following code.
CrimeLab.get(getActivity()).deleteCrime(mCrime);
Then the database remains to updated.
you can create updateCrime() method in CrimeLab.

 public void updateCrime(CrimeDec upCrime) {
        String uuidString = upCrime.getId().toString();
        ContentValues upValues = getContentValues(upCrime);

        mDatabase.update(CrimeTable.TABLE_NAME, upValues, CrimeTable.Cols.UUID + " = ?", new String[]{uuidString});

    }

Then, you call it from the fragment for both to update that deleteCrime and interface.

      private void updateCrime() {
            CrimeLab.get(getActivity()).updateCrime(mCrime);
         }

you can use it for updatable events.

public class CrimeFragment extends Fragment {
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.fragment_crime, menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.delete_crime:
            CrimeLab.get(getActivity()).deleteCrime(mCrime);
               updateCrime();
            getActivity().finish();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
}