Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: "Pro Android 3" Book Example Code Question

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default "Pro Android 3" Book Example Code Question

    Hello, All, and thank you for providing these great forums!

    I'm new to Java and picked up the book "Pro Android 3" by Komatineni, MacLean, and Hashimi the other day.

    So, while going through it, I ran across this part [page 45]:

    The application's root package name is defined as an attribute of the <manifest> element in the AndroidManifest.xml file, and each activity has a name attribute.

    Once the entry-point activity is determined, the host starts the activity and the onCreate() method is called. Let's have a look at NotesList.onCreate(), shown in listing 2-2.

    public class NotesList extends ListActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
     
          setDefaultKeyMode(DEFAULT_KEYS_SHORTCUT);
          Intent intent = getIntent();
          if (intent.getData() == null) {
              intent.setData(Notes.CONTENT_URI);
          }
     
          getListView().setOnCreateContextMenuListener(this);
     
    // rest of code listed in the book left out for brevity
    My problem is that I can't find that code in any file or folder showing up in Eclipse's "Project Explorer"/"Navigator." (I'm using Eclipse "Version: Indigo Service Release 2 -- Build id: 20120216-1857" by the way.)

    Can somebody please point me in the right direction?


  2. #2
    Junior Member
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: "Pro Android 3" Book Example Code Question

    Wow. Please disregard the OP above. I found the problem -- after studying java almost non-stop for the past few days. It seems the code in the book does not accurately reflect what's in the actual NotesList.java src file. The writers/editors have removed the comments that appear in the actual java file and re-arranged the spacing of some of the lines so it looks at first glance as if the code isn't the same (especially if you're totally new to java), but the code is indeed the same -- it just looks different.

    Thanks anyway!

Similar Threads

  1. Replies: 3
    Last Post: December 7th, 2011, 01:03 AM
  2. Replies: 7
    Last Post: August 13th, 2011, 01:22 AM
  3. "The import ___ cannot be resolved" (stupid noob question)
    By RobG in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 18th, 2010, 02:09 PM
  4. [SOLVED] "possible loss of precision", except not, code doesn't work, simple question
    By Perd1t1on in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 24th, 2010, 07:11 PM
  5. "java.lang.NoSuchMethodError: main" and "fatal exception occured."
    By joachim89 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 10th, 2010, 07:35 AM