The Android Notepad tutorial (exercise 2)
If you are continuing to follow the android Notepad tutorial, you will now be carrying out exercise 2. This adds a context menu and has a separate NoteEdit activity invoked to create or edit Notes. This exercise is well documented in http://developer.android.com/resources/tutorials/notepad/notepad-ex2.html
I again found this exercise very straight-forward. Here are a few tips I found helpful
1. By this stage we have several android projects within the Eclipse IDE, including another called Notepad. I found it useful to close all other projects so I was sure I was only editing classes within the current exercise. To do this enter the Java perspective, find the current project within the package explorer window and choose close unrelated projects.
2. In step 2 I got an error
Pressing Control-Shift-O to import any missing packages resolved this.
3.You may, like me, have wondered about the purpose of the line @Override that occurs before many of the methods of the Notepadv2 class, and the onCreate() method of the NoteEdit class. @Override is an annotation that tells the compiler that we are over-riding an existing method of the supertype. It tells the Java compiler to generate an error if the method does not exist in the supertype.
I again found this exercise very straight-forward. Here are a few tips I found helpful
1. By this stage we have several android projects within the Eclipse IDE, including another called Notepad. I found it useful to close all other projects so I was sure I was only editing classes within the current exercise. To do this enter the Java perspective, find the current project within the package explorer window and choose close unrelated projects.
2. In step 2 I got an error
OnCreateContextMenu must override a supertype.
Pressing Control-Shift-O to import any missing packages resolved this.
3.You may, like me, have wondered about the purpose of the line @Override that occurs before many of the methods of the Notepadv2 class, and the onCreate() method of the NoteEdit class. @Override is an annotation that tells the compiler that we are over-riding an existing method of the supertype. It tells the Java compiler to generate an error if the method does not exist in the supertype.
Comments
Post a Comment