496 CHAPTER 13: Android Service Class and Threads: Background Processing
- As you can see in Figure 13-12, you will need to mouse over the reference
to the View class and then select the Import ‘View’ (android.view) option,
which will write your import android.view.View; line of code for you.
Once the import statement for the use of the View class is in place, you can continue to build the
event handler.
Once you import the View class into your class, you will get a second wavy red error highlight,
as shown in Figure 13-13, underneath the View object’s method call to its .OnClickListener( )
method. If you mouse over this error, the Eclipse pop-up helper will tell you that you need to add the
unimplemented .onClick( ) method, as shown in Figure 13-13.
Figure 13-12. Add event handling to the soundOn ImageView object using .setOnClickListener( ) and new keyword
Figure 13-13. After you select an Import View (android.view) option, select an Add Unimplemented Method option