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
| 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 Search this Thread Display Modes
  #1 (permalink)  
Old June 10th, 2010, 12:41 AM
Registered User
 
Join Date: Jun 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 4 ToDoList runs but no custom view?

I was able to get chapter 4 ToDoList to compile and run. I can see my ToDo List. I can add and remove items via the menu. The application seems quite functional except I'm not seeing my custom ListItemView rendered. The code walks through adding a custom view based on TextView. This view is then used as the layout with this code:
Code:
int resID = R.layout.todolist_item;
final ArrayAdapter<String> aa = new ArrayAdapter<String>(this, resID, todoItems);
myListView.setAdapter(aa);
but it doesn't seem to make a difference in what I see on the emulator. I can change the line of code to this:
Code:
int resID = android.R.layout.simple_list_item_1;
final ArrayAdapter<String> aa = new ArrayAdapter<String>(this, resID, todoItems);
myListView.setAdapter(aa);
and it renders the same. I followed the example completely and even copied the code from the download. I am not new to programming and have programmed or ported several J2ME games in the past. I am missing something I think. I can post code if that helps, but I basically used the source directly from the book download and the results are the same. Thanks in advance.

** I forgot to add that I set a breakpoint in the code on the draw method (and the init method) but neither one fired. The breakpoints in my activity did fire however.

Last edited by scottm; June 10th, 2010 at 01:30 AM..
Reply With Quote
  #2 (permalink)  
Old June 10th, 2010, 05:13 PM
Registered User
 
Join Date: Jun 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Nevermind - Figured it out: The book is wrong

Well, I got tired of lack of support from the $45 I spent (I hope you enjoy the last money you get from me Reto) so I googled it. Amazing what one can find for free. It turns out you need to use a custom adapter which isn't covered until chapter 6. I read some bad reviews on this book, but decided to give it a chance because the complaints seemed petty. Now I see what they were saying. I spent $50 (after shipping and handling) only to have to go to the internet anyway in order to solve a basic problem that should have been clarified in the text.

I'm really disappointed in the quality of this book as I have come to expect a bit more from the Wrox label. I guess the rumors are true that the "old" wrox spirit is dead and they basically give anyone a book deal these days. I spent 8 years in the mobile application market - maybe I should write a worthless book?
Reply With Quote
  #3 (permalink)  
Old June 14th, 2010, 04:37 PM
Authorized User
Points: 123, Level: 2
Points: 123, Level: 2 Points: 123, Level: 2 Points: 123, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2010
Posts: 18
Thanks: 0
Thanked 6 Times in 3 Posts
Default Works for me

Scott,

Are you sure you followed Step 6 (page 96)? I don't know about other users, but this example worked for me out of the box.
Reply With Quote
  #4 (permalink)  
Old June 21st, 2010, 01:22 AM
Registered User
 
Join Date: Jun 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dr. Garibaldi,

Make up your mind, did it work for you or not? You are the one that started this thread indicating that you couldn't see the custom view.
Reply With Quote
  #5 (permalink)  
Old June 21st, 2010, 02:11 AM
Authorized User
Points: 123, Level: 2
Points: 123, Level: 2 Points: 123, Level: 2 Points: 123, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2010
Posts: 18
Thanks: 0
Thanked 6 Times in 3 Posts
Default

Quote:
Originally Posted by chuckycjc View Post
Dr. Garibaldi,

Make up your mind, did it work for you or not? You are the one that started this thread indicating that you couldn't see the custom view.
!"DrGaribaldi".equals("scottm")
Reply With Quote
  #6 (permalink)  
Old June 21st, 2010, 11:45 AM
Registered User
 
Join Date: Jun 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by DrGaribaldi View Post
!"DrGaribaldi".equals("scottm")
Ha ha - very clever Dr Garibaldi. Yes, chukycjc, it was I who created the original post, or in internet parlance I am the OP.

As to the question of whether I got it to work, if you read my follow up post you will see that indeed I did get it to work, however I had to get the answer somewhere else. As it turns out, the answer was in the book, just in the next chapter. The author jumps around a bit which is what got me confused.
Reply With Quote
  #7 (permalink)  
Old June 21st, 2010, 11:52 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

Hi Scott,
I'm sorry you're so disappointed. I try to reply to as many questions as I can, but unfortunately I have finite time. Certainly I never intended the book to be used in isolation from the Internet -- the Android SDK documentation, support groups and StackOverflow have been invaluable to me in learning Android and I'd certainly recommend them to anyone using my book.

That said, I can't replicate the problem you're describing. There's no need to use a custom Adapter to modify the layout used to display each ListView Item as described in Chapter 4.

It's hard to tell what may have gone wrong without seeing your code, but my guess is that it's happening in Step 6 - it seems that your custom TextView isn't being used. It might be useful if you shared the todolist_item.xml you're using, I suspect that perhaps you may not have specified the custom class (com.paad.todolist.TodoListItemView) in place of TextView.
__________________
Reto Meier

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

Quote:
Originally Posted by Reto View Post
Hi Scott,
I'm sorry you're so disappointed. I try to reply to as many questions as I can, but unfortunately I have finite time. Certainly I never intended the book to be used in isolation from the Internet -- the Android SDK documentation, support groups and StackOverflow have been invaluable to me in learning Android and I'd certainly recommend them to anyone using my book.

That said, I can't replicate the problem you're describing. There's no need to use a custom Adapter to modify the layout used to display each ListView Item as described in Chapter 4.

It's hard to tell what may have gone wrong without seeing your code, but my guess is that it's happening in Step 6 - it seems that your custom TextView isn't being used. It might be useful if you shared the todolist_item.xml you're using, I suspect that perhaps you may not have specified the custom class (com.paad.todolist.TodoListItemView) in place of TextView.
Thanks for getting back to me Reto. It's actually partially my fault. You can go ahead and say it - RTFM (or RTFB in this case). I hadn't read far enough ahead and was impatient for results. I let my frustrations get the best of me. As usual it was something entirely in my control and had I paid closer attention I would have seen it. I partially blame the situation on the fact that this is the first Kindle book I've bought (I was too impatient to wait for the hard copy) so the learning paradigm is a little different than what I'm used to.
Reply With Quote
  #9 (permalink)  
Old June 21st, 2010, 01:04 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

Hey: no harm, no foul. As long as your problem's been fixed it's all good.

Sorry for taking so long getting back to you though, it's been a mad house around here! :)
__________________
Reto Meier

Author, "Professional Android 4 Application Development", Wrox, ©2012, 2010, 2008
@retomeier
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 2 todolist kdpohl1 BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 5 July 16th, 2010 03:59 AM
Chapter 6 Todolist & SQLITE3 JHandal BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 1 April 28th, 2010 12:57 PM
Chapter 4 - customizing ToDoList - ruled lines not working correctly gregking BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 1 April 3rd, 2009 09:44 AM
Chapter 4 - creating a view MarieMcKeeth BOOK: Beginning Ruby on Rails 1 March 21st, 2009 06:56 PM
Chap 2 ToDoList - Stopped Unexpectedly sierawsk BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 1 March 4th, 2009 01:14 PM



All times are GMT -4. The time now is 11:17 PM.


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