OSDN Git Service

Fix Notepadv3Solution orientation changes during NoteEdit
authorTom O'Neill <tomo@google.com>
Sat, 12 Dec 2009 00:01:04 +0000 (16:01 -0800)
committerTom O'Neill <tomo@google.com>
Sat, 12 Dec 2009 00:03:52 +0000 (16:03 -0800)
commit7c21d1cd4051a7aaab5c15d63649315708c6aaa4
treef1738ae1e528cc5d88bba2e2777562349137d239
parentd0225ee63f305ef59e17f8ad0dc16b2ef5e85af0
Fix Notepadv3Solution orientation changes during NoteEdit

The current NoteEdit.java in Notepadv3Solution crashes on NPE when the
screen orientation changes.  This happens because a null Long is
auto-unboxed to a long when used as an input to
Bundle.putLong(String, long).  The easiest solution is to use
Bundle.putSerializable() instead.

In addition duplicate notepad entries could result because mRowId was not
necessarily defined when onSaveInstanceState(Bundle) was called.  The
solution to that is to call saveState() in that method.

Fixes these buganizer bugs:

Change-Id: Ice325f3b089867e4716deb48aefe8ec03f30ad55
http://b/issue?id=2266994
http://b/issue?id=2266962
tutorials/NotepadCodeLab/Notepadv3Solution/src/com/android/demo/notepad3/NoteEdit.java