 |
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 10th, 2010, 12:41 AM
|
|
Registered User
|
|
Join Date: Jun 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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..
|
|

June 10th, 2010, 05:13 PM
|
|
Registered User
|
|
Join Date: Jun 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|
|

June 14th, 2010, 04:37 PM
|
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 18
Thanks: 0
Thanked 6 Times in 3 Posts
|
|
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.
|
|

June 21st, 2010, 01:22 AM
|
|
Registered User
|
|
Join Date: Jun 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

June 21st, 2010, 02:11 AM
|
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 18
Thanks: 0
Thanked 6 Times in 3 Posts
|
|
Quote:
Originally Posted by chuckycjc
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")
|
|

June 21st, 2010, 11:45 AM
|
|
Registered User
|
|
Join Date: Jun 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by DrGaribaldi
!"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.
|
|

June 21st, 2010, 11:52 AM
|
 |
Wrox Author
|
|
Join Date: Oct 2008
Posts: 61
Thanks: 1
Thanked 7 Times in 6 Posts
|
|
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.
|
|

June 21st, 2010, 12:20 PM
|
|
Registered User
|
|
Join Date: Jun 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Reto
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.
|
|

June 21st, 2010, 01:04 PM
|
 |
Wrox Author
|
|
Join Date: Oct 2008
Posts: 61
Thanks: 1
Thanked 7 Times in 6 Posts
|
|
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! :)
|
|
 |