Question about the Notepad example from the SDK

Put your problem here if it does not fit any of the other categories.

Question about the Notepad example from the SDK

Postby llesslie » Sun Jan 24, 2010 1:03 am

I'm new to android programming, so I'm not always sure about why certain things are done. I went through the basic Notepad tutorials on the website, and now I'm looking at the Notepad application in the SDK. I notice the primary difference is that the SDK example uses a content provider instead of accessing the database directly. I like the concept, but I'm a little confused about why the NotePad.java class is defined twice. It's defined in its own package, com.google.provider, which is of course the same as the authority defined for the content provider in the example. NotePad.java is also defined in the main example package. Are both definitions really needed? I usually try to avoid duplicate definitions like this in projects I write, because inevitably someone forgets to change the definition in both places. In particular, I was wondering about the need for the com.google.provider package at all. From the documentation I gather that the authority definition is arbitrary, it just has to be unique. I'm not sure why the authority couldn't have been com.example.android.notepad.NotePadProvider. I hope this question isn't too pedantic, but I just want to know if there is any reason why there are two NotePad.java classes defined in the Notepad example bundled with the SDK. Thank you very much for your insights.
llesslie
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Jan 23, 2010 11:27 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 17 guests