Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

Ni Yao
Ni Yao
3,852 Points

App crashes when deleting

The version I downloaded must've been modified afterwards as it contained an extra line that crashes the app upon deleting. Took me a while to find it.

Toast.makeText(MemeItemFragment.this.getActivity(), "Should delete", Toast.LENGTH_LONG).show();

MemeDataSource dataSource = new MemeDataSource(MemeItemFragment.this.getActivity());

dataSource.delete(memeId);

refreshMemes();

/This line causes the crash, just remove it and it works like a charm/mMemeItemListAdapter.notifyDataSetChanged();

mMenu.findItem(R.id.share_action).setVisible(true);

mMenu.findItem(R.id.edit_action).setVisible(true);

Steven Parker
Steven Parker
229,968 Points

Are you sure this was intended for the "Databases" topic? You can change the topic in the "Edit Question" area.

Also, please provide a link to the course page you are referring to.