O'Reilly logo

Android™ How to Program, Second Edition by Abbey Deitel, Harvey Deitel, Paul Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.5.8. Anonymous Inner Class That Implements the ListView’s OnItemLongClickListener to Share, Edit or Delete a Search

Figure 4.25 declares and initializes instance variable itemLongClickListener, which refers to an anonymous inner-class object that implements interface OnItemLongClickListener. Line 70 (Fig. 4.20) registered itemLongClickListener as the ListView’s event handler that responds when the user long presses an item in the ListView. Lines 153–210 override interface OnItemLongClickListener’s onItemLongClick method.

148      // itemLongClickListener displays a dialog allowing the user to delete149      // or edit a saved search150      OnItemLongClickListener itemLongClickListener =151         new OnItemLongClickListener() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required