Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Android 4 Application Development
This is the forum to discuss the Wrox book Professional Android 4 Application Development Reto Meier; ISBN: 978-1-1181-0227-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android 4 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 10th, 2013, 12:45 AM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question Chapter 7 - Earthquake Part 1

When I try to run this, my preferences activity does not start. This happens whether I run my own app or the one downloaded from Wrox.

I noticed that when I create a new Android Application Project, I have a file <project>/res/menu/main.xml and my main activity has a skeleton onCreateOptionsMenu() function. If I don't delete these - the 'menu' folder and the function skeleton - my projects will not build. Do I need to insert something into this Earthquake Part 1 project to replace what I deleted?
Reply With Quote
  #2 (permalink)  
Old May 13th, 2013, 06:36 AM
Authorized User
Points: 89, Level: 1
Points: 89, Level: 1 Points: 89, Level: 1 Points: 89, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2013
Posts: 27
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 7 - Earthquake Part 1

Hi oddstray,

The earthquake part 1 code in ch 7 does not make use of any xml file in res/menu, as there isn't such. So i don't understand what you want to do with /menu/main.xml? Build without that should go without errors, what errors do you see?
After clicking menu and then "Preferences" an intent is sent to start preferencesActivity that will show res/layout/preferences.

Good luck!
Reply With Quote
  #3 (permalink)  
Old May 13th, 2013, 10:18 PM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 7 - Earthquake Part 1

I do not see any errors.

What I do with /menu/main.xml is to delete it because it is not used or needed, before I build (my projects will never build unless I delete /menu/main.xml and the onCreateOptionsMenu() override in the main activity class).

When I run the my code for the first part of Chapter 7, or when I run the downloaded book code for the first part of Chapter 7, after clicking the menu and then "Preferences", the res/layout/preferences is not shown. Nothing happens (and there are no additional messages in my Console or in LogCat).
Reply With Quote
  #4 (permalink)  
Old May 14th, 2013, 05:57 AM
Authorized User
Points: 89, Level: 1
Points: 89, Level: 1 Points: 89, Level: 1 Points: 89, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2013
Posts: 27
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 7 - Earthquake Part 1

This is very odd, oddstray

I just loaded the code on eclipse and found no problems, the only way that PreferencesActivity does not show up is when i don't have
Code:
public boolean onOptionsItemSelected(MenuItem item){
....
}
implemented. Be sure that here the intent is really sent.
Reply With Quote
  #5 (permalink)  
Old May 17th, 2013, 12:21 AM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default D'oh!

Hmmm ... first, when I thought I was running the book code, my Eclipse insisted on running my code. So, it didn't work.

Tonight when I started Eclipse I ran the book code first thing. Then it ran correctly.

And d'oh! What I found was the "onOptionsItemSelected" != "onOptionsItemSelection"


Thanks for helping!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 9 Earthquake Part 3 majeedk BOOK: Professional Android 4 Application Development 0 December 1st, 2012 07:30 AM
Chapter 7 Earthquake 2, Earthquake.java, error onActivityResult dbomberg BOOK: Professional Android 2 Application Development 2 November 30th, 2012 05:52 AM
Earthquake chapter 7 part 2 layingincouch BOOK: Professional Android 4 Application Development 1 October 31st, 2012 05:54 PM
Chapter 7 Part 2 Earthquake Exception clombardo BOOK: Professional Android 2 Application Development 3 April 29th, 2010 10:46 AM
Getting Exception after the Correction -for Chapter 6 Part 2 Earthquake project clombardo BOOK: Professional Android 2 Application Development 1 April 26th, 2010 06:03 AM



All times are GMT -4. The time now is 09:27 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.