Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Professional Android 2 Application Development
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Android 2 Application Development
This is the forum to discuss the Wrox book Professional Android 2 Application Development, 2nd Edition by Reto Meier; ISBN: 978-0-470-56552-0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android 2 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 Display Modes
  #1 (permalink)  
Old March 4th, 2010, 02:25 AM
Registered User
 
Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Needed imports for Chapter 2 To-Do List Example

Not sure why the book failed to mention the proper imports needed for the chapter 2 to-do list example to compile correctly. If you're entering the code manually (this chpt. 2 to-do list example code is not available for download), add the following import statements or simply apply the control+shift+o import shortcut in eclipse.

import java.util.ArrayList;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnKeyListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;

Programming Android doesn't have to be like a raging hemorrhoid...

Last edited by alex_harding; March 4th, 2010 at 12:15 PM.
Reply With Quote
  #2 (permalink)  
Old March 6th, 2010, 12:20 PM
Reto's Avatar
Wrox Author
Points: 287, Level: 5
Points: 287, Level: 5 Points: 287, Level: 5 Points: 287, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2008
Location: London, United Kingdom
Posts: 61
Thanks: 1
Thanked 7 Times in 6 Posts
Default

Hi Alex,
Thanks for contributing the required imports for the Chapter 2 Todo List example. You may have posted this before I posted the code samples online, but the full code for this example (and all the others) should be available from here: http://www.wrox.com/WileyCDA/WroxTit...-DOWNLOAD.html

If that's not the case, please let me know!

The reason I didn't include all the import statements for each example is to try and keep the code as concise as possible. As a 'Professional' title it assumes a certain level of knowledge and experience - in particular I'm hoping that most people using the book know how to use the shortcut you specified to add any required imports.

You make a fair point though - for the next revision I'll explicitly mention the shortcut to try and make peoples lives a little easier.

Thanks for the feedback!
__________________
Reto Meier

Author, "Professional Android 4 Application Development", Wrox, ©2012, 2010, 2008
@retomeier
Reply With Quote
  #3 (permalink)  
Old March 7th, 2010, 09:36 AM
Registered User
 
Join Date: Mar 2010
Location: Charlotte, NC
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by alex_harding View Post
Not sure why the book failed to mention the proper imports needed for the chapter 2 to-do list example to compile correctly. If you're entering the code manually (this chpt. 2 to-do list example code is not available for download), add the following import statements or simply apply the control+shift+o import shortcut in eclipse.

import java.util.ArrayList;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnKeyListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;

Programming Android doesn't have to be like a raging hemorrhoid...
If you are doing this by hand, you will also need:
import android.os.Bundle;

This is used in your public void onCreate(Bundle savedInstanceState) method. Like the author mentioned, Eclipse will do this for you.
Reply With Quote
  #4 (permalink)  
Old March 9th, 2010, 02:35 PM
Registered User
 
Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thanks Reto!

Wow, I do appreciate an author that supports the book's user base by being an active and timely participant in these forums. Kudos to you Reto.

Given that the content of this "Professional" book focuses primarily on exploring android-specific functionality available within the packages of the Android SDK, I guess I fail to understand how readers of different development backgrounds would know or "hope" to know what packages to import for the android-specific View objects introduced the Chapter 2 example code. Why have Eclipse bark at you so early on when in later chapters it appears you do a good job in the text to introduce the packages you need to support the added functionality of the To-Do example?
Reply With Quote
  #5 (permalink)  
Old March 21st, 2010, 03:48 AM
Registered User
 
Join Date: Mar 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Regarding: "As a 'Professional' title it assumes a certain level of knowledge and experience - in particular I'm hoping that most people using the book know how to use the shortcut you specified to add any required imports."

I am a long term Windows C++ programmer, but new to Android, and therefore Java/Eclipse. So, I agree with other comments; a quick into to Java/Android/Eclipse (or reference section in the back?) would save a lot of grief for those of us coming from different dev systems. Great book, thanks!

P.S. Do you have a recomendation for a book to help C++ developers get started in this environment?
Reply With Quote
  #6 (permalink)  
Old March 21st, 2010, 08:18 AM
Reto's Avatar
Wrox Author
Points: 287, Level: 5
Points: 287, Level: 5 Points: 287, Level: 5 Points: 287, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2008
Location: London, United Kingdom
Posts: 61
Thanks: 1
Thanked 7 Times in 6 Posts
Default

It's a good point, and something I definitely intend to rectify in the next edition. It seems a couple of pages introducing Eclipse would be extremely useful. Thanks for the feedback!
__________________
Reto Meier

Author, "Professional Android 4 Application Development", Wrox, ©2012, 2010, 2008
@retomeier
Reply With Quote
  #7 (permalink)  
Old June 12th, 2010, 09:49 PM
Registered User
 
Join Date: Jun 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Reto,

Take a look at Jeff LaMarche/Dave Mark iPhone 3 Development book. They always provided the necessary imports in the text code (they had a couple of mistakes along the way)

If your book is targeting beginners then its important to provide the necessary detail so the program will run correctly as entered from the text without relying on the source code.

I have some experience with iPhone development and Java and Eclipse helped me determine what was wrong right away. A less experienced programmer could waste alot of time, which would increase the chances of your book ending up in the trash!

Thanks,
Reply With Quote
  #8 (permalink)  
Old September 19th, 2010, 08:57 PM
Registered User
 
Join Date: Sep 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default I needed this one

Thanks to everyone for jumping in here. I tried the code twice, but did not know to import these functions.

Also a professional, use Ruby quite a bit, but am relatively new to Java. This was a big help.
Reply With Quote
  #9 (permalink)  
Old March 11th, 2011, 04:10 PM
Registered User
 
Join Date: Mar 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Version Depenant ?

I have all the right imports showing but have errors on every line of my todo list project from chapter 2. I am running Android 2.1 update. Is this incompatible wit hthe instructions in the book which qare for 2.0 ?
Reply With Quote
  #10 (permalink)  
Old March 12th, 2011, 08:29 AM
Registered User
 
Join Date: Mar 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Android API

Hi, fmgerber@verizon.net.
Yes some android api's are version dependent, the best solution is to develop the android application for basic version, if you are looking for wide use of your app on any android phone, since there is a upward compatibility. If you get stuck in - what import statements to use, then you can write the entire code first and then make use of eclipse feature(if your using it) of auto-importing the packages by pressing Ctrl+O.
If you still find any problems in todo program, then use Android API 2.2 - the one i used for running my programs. And one more thing the variable names used in main.xml and in your java program has to be same. I hope this helps.
Reply With Quote
Reply


Thread Tools
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
imports - Chapter 2 sfarber53 BOOK: Beginning Java 2 2 September 19th, 2010 08:43 PM
List Style & Positioning Help Needed DanDan CSS Cascading Style Sheets 1 February 23rd, 2005 02:56 PM
Imports with .VB files Doldrums VB.NET 2002/2003 Basics 6 November 11th, 2004 09:58 AM
Excel Text Imports Revisited bph Access 5 April 1st, 2004 07:35 AM
Help on ListBox imports text tdeng Beginning VB 6 2 December 22nd, 2003 02:46 PM



All times are GMT -4. The time now is 03:16 PM.


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