Problem with deleteCrime()


#1

Hi all
to delete a crime ,I included the code in both
CrimeLab and Crime List Fragment

but the get() in switch statement isn’t indicating the deleteCrime() of CrimeLab class

This is my problem
CrimeLab.java

public void deleteCrime(Crime c)
	{
		mCrimes.remove(c);
	}

CrimeListFragment.java


	@Override
	public boolean onContextItemSelected(MenuItem item) {
	AdapterContextMenuInfo info = (AdapterContextMenuInfo)item.getMenuInfo();
	int position = info.position;
	CrimeAdapter adapter = (CrimeAdapter)getListAdapter();
	Crime crime = adapter.getItem(position);
	
	
	switch (item.getItemId()) {
	case R.id.menu_item_delete_crime:
	CrimeLab.get(getActivity()).deleteCrime(crime);
	adapter.notifyDataSetChanged();
	return true;
	}
	return super.onContextItemSelected(item);
}

Can anyone say what the error is…???

“The method deleteCrime(Crime) is undefined for the type CrimeLab” — this is the error i’m getting


#2

got solved :slight_smile: :slight_smile: