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 Application Development ISBN: 978-0-470-34471-2
This is the forum to discuss the Wrox book Professional Android Application Development by Reto Meier; ISBN: 9780470344712
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 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 March 1st, 2009, 09:44 PM
Registered User
 
Join Date: Mar 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 Todo List removeItem

To get removeItem to work correctly in chapter 6, add the id field to the ToDoItem class (create a getID function and also update the constructor to accept the id). When the items are created in updateArray, get the id and pass it to the new ToDoItem as you do for the task and date. Now, when you want to remove an item, you can get the id of the item and pass it to the removeItem function (delete the code that inverses the index).
Reply With Quote
  #2 (permalink)  
Old May 18th, 2009, 09:07 AM
Registered User
 
Join Date: May 2009
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Remove Item chapter 6 To Do Example

I have entered the code for the example. At each step it worked. After the last step it worked briefly, even remove item worked. Then the whole lot crashed and I can't get eclipse to even load the app now. I have posted about this. When I get going again I would like to follow your tips about remove item, but I don't know how to do the things you have said. Would you be able to provide the specific code changes please?
Reply With Quote
  #3 (permalink)  
Old May 18th, 2009, 10:14 AM
Authorized User
 
Join Date: Mar 2009
Posts: 21
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You shouldn't have to make those changes to the ToDoList example. My app works fine removing items. Does it cause yours to crash?
Reply With Quote
  #4 (permalink)  
Old May 18th, 2009, 09:17 PM
Registered User
 
Join Date: May 2009
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Remove Item chapter 6 To Do Example

Thanks Sierawsk. After turning the computer off overnight, Eclipse will now run the app. Mostly remove item doesn't work but occasionally it will remove an item, but the wrong item.

Mike
Reply With Quote
  #5 (permalink)  
Old February 5th, 2010, 11:18 AM
Registered User
 
Join Date: Feb 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 Todo List removeItem

Hi guys

I am new to this. I noticed that the last message was posted sometime ago. Just want to know if the problem was solved because I am encountering the same problem.

Anyway I have found out that the reason why sometimes the "remove" worked and sometimes it won't. It is due to the SQLite Database having a different row Id value compared with the chosen menu item position value. The row ID of the database only increases. It won't decrease even if the item is removed. So for example after 100 clicks the row ID in the DB will have increased to 100. If your list happen to have for e.g 6 items. Passing in the positions of this 6 items (value of 1 to 6) may not necessary match to row ID of the DB where this 6 items are stored.

One way to solve this is as mentioned to store the row ID used by SQ Lite database in the item. However I can't see how it can be done yet.

Appreciate if anyone has any suggestions.
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
Issues with Chapter 2 Todo List .add() on key listener Swak BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 2 January 22nd, 2010 06:43 AM
Chapter 7 - List Views Not Refreshing VBNovice BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 3 January 31st, 2007 08:26 PM
TODO Samikaraeen Pro VB 6 1 August 3rd, 2004 12:24 PM



All times are GMT -4. The time now is 03:36 AM.


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