app/src/main/java/com/pcp/simpletodo/MainActivity.java
//Only executed when there is a long press on an item
Only executed when there is a long press on an item
Only executed when there is a long press on an item
@Override
            public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
                String itemDeleted = items.get(position);
                items.remove(position);
                itemsAdapter.notifyDataSetChanged();
                writeItems();
                Toast.makeText(getApplicationContext(),"" + itemDeleted + " deleted" , Toast.LENGTH_SHORT).show();
                return true;
            }
@ Override public boolean onItemLongClick ( AdapterView < ? > parent , View view , int position , long id ) { String itemDeleted = items . get ( position ) ; items . remove ( position ) ; itemsAdapter . notifyDataSetChanged ( ) ; writeItems ( ) ; Toast . makeText ( getApplicationContext ( ) , "" + itemDeleted + " deleted" , Toast . LENGTH_SHORT ) . show ( ) ; return true ; }
Only executed when there is a long press on an item
Only executed when there is a long press on an item