Problem in the Notepadv3 tutorial code...

by Raymond Ingles » Wed, 12 May 2010 15:12:57 GMT

Sponsored Links
 I've been working through the Notepad tutorial (  ) and
it's been helpful. I'm aware that the second version has a bug, that
is fixed in the third stage. However, the third stage (Notepadv3)
still has a problem:

 Choose "Add Note", then change the orientation. The note editing
activity crashes when the orientation changes, in
ActivityThread.performPauseActivity() with a NullPointerException. I'm
not quite familiar enough with this platform to figure out what the
issue is. I thought it had something to do with saving the row, but I
thought I fixed that and it still bombs out.

 It's easy to reproduce the problem in the debugger. Can anyone
explain what causes the crash? This might be a very good thing to get
fixed; I presume a fair number of developers are going to look at that
code and assume it's "the way to do it"... Thanks for any help y'all
can provide!


Other Threads

1. How to open asset as a File rather than an InputStream??

Hi All,

I found an example on the internet that reads in XML files and can
parse out the elements that I am interested in. In regular Java (not
an android project) I just used:

File file = new File("C:\\textfiles\\test.plist");
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  Document doc = db.parse(file);
  NodeList nodeLst = doc.getElementsByTagName("element1");
. ..stuff that iterates through the file and parses the elements i'm
interested in....

I'm able to parse out the elements I want and output them to the
screen as Strings.

However, in the android project I'm working on I'm trying to do the
same thing. I put an XML file in the assets folder called
"test.plist". It's basically just some XML. The same file I was able
to read above.

However, my problem is that the only way I can see to open this file
is using:

InputStream is = getAssets().open("test.plist");

I'm kind of a noob to programming in general so I don't know how to
use the InputStream to parse the file and basically extract the data
from the XML file that I want.


1) Is there anyway for me to open the "test.plist" file in the asset
folder as a File class rather than an InputStream class.

2) If that is not possible do you have any suggestions on how to
either convert the InputStream into a File or any ideas on how to
parse the XML file using an InputStream instead.

Thanks very much for any and all help! It's much appreciated.


2. Creating a ContextMenu on a ListView

Hey guys,

yesterday I had some problems (maybe a bug) creating a ContextMenu on
a ListView.
I thought that my final solution could be interesting for you too.

So here is the resulting tutorial:

Regards, plusminus
#  Worlds largest Android Development Community / Tutorials

3. Why would carriers carry Android phones

4. Creating ContextMenu on a ListView

5. Moved form Android Challenge group: Question concerning eligibility

6. set EditText properties

7. WYSIWYG UI Builder for Android?