1. Check out our companion app, Forums for Android! Download from Google Play

Notepad Tutorial Version 2 Problems

Discussion in 'Application Development' started by Arigead, Jan 21, 2010.

  1. Arigead

    Arigead Member
    Thread Starter

    Nov 24, 2009
    I've been working through the Notepad Tutorials shipped with Android and struggling as I can't get the second version to work:

    Android Developers

    I've run this application on both a phone (HTC Hero) and in Eclipse in the emulator and there is no context menu for each added note to Delete the note or Edit it. I've tried changing the minimum version of the project and have been using the solution version of the project instead of the one I completed and still no joy.

    Has anybody gotten this project working. I'd really like to see the Context Menu working as I'd like to use it in other apps.

    Thanks in advance for any help.


  2. scottbiggs

    scottbiggs New Member

    Aug 31, 2010
    Yeah, I see this is a popular topic--almost a year with no follow-ups. I've been having problems with the same bit of the Notepad tutorial. For me, the program runs and does *nothing*.

    I had a hell of a time compiling the damn thing as command-shift-O initially inserted the line:

    import android.R;

    which overrides my own R.java files.

    But I'm at a loss as to why the program fails to respond to any user input at all. Time to bear down and work at this bug!
  3. I never ran through the notepad tutorials before but I just grabbed the V2 solution and built it to the emulator against Android 2.2. If I long press (well, long click) on a note I've added, I get the "Delete Note" option in the context menu. A regular click brings the note up for editing (and pressing back crashes it, haha).

    What happens when you guys tap a note? What about long press?
  4. jetak

    jetak New Member

    Aug 30, 2010
    Yeah, a long press on the actual note brings up a delete note menu, a short press (tap) bring up the editor and pressing the Menu Button brings up the Add Note option. The Tutorial instructions do not make this very clear.

    I also had a hell of a time with the auto generation of the R.java file. I had to modify the provided note_edit.xml file. Any place that had "match_parent" I had to change to "wrap_content".

    i.e android:layout_width="match_parent" -> android:layout_width="wrap_content"

    Without this change Eclipse complained:
    blah blah blah.

    After the change and removing all the import android.R that cmd-shift-O brought in I was able to rebuild and get the app running.
  5. "match_parent" is the same as "fill_parent." If Eclipse does not recognize it, you need to verify that you are building against 2.2
    Moonfire likes this.
  6. heinduplessis

    heinduplessis Active Member

    Jul 8, 2010
    Now *this* is a valuable piece of information. Thanks!

    Wish google's tutorials would stop stating the obvious and clear up the mysteries!

Share This Page