Deal of the Day

Home » Main » Manning Forums » 2010 » Android in Practice

Thread: DealDroid - re-parse feed

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 4 - Pages: 1 - Last Post: Feb 15, 2011 4:40 PM by: plorent Threads: [ Previous | Next ]
plorent

Posts: 19
From: Netherlands
Registered: 10/2/08
DealDroid - re-parse feed
Posted: Feb 10, 2011 2:53 PM
  Click to reply to this thread Reply

I'm finishing chapter 2 where we build the DealDroid and have installed the app on my device. When using the app, the menu-option 're-parse feed' to me results in unexpected behavior and a bug. If I'm in another deal list it gets me the 'default' Daily List, but the spinner is not updated. When tapping an item in the list, the wrong item appears in the DealDetails. It gives you the details for a deal that was in that position in the 'previous' list - before re-parsing the feed.
Although the concepts in the chapter are very clearly written - thanks for that - shouldn't this bug be fixed, or used as a debug example?

charlie.collins

Posts: 125
Registered: 3/8/07
Re: DealDroid - re-parse feed
Posted: Feb 10, 2011 3:09 PM   in response to: plorent in response to: plorent
  Click to reply to this thread Reply

Absolutely it should be fixed. I didn't know it was that buggy, but I'll look at it ASAP and try to get an update out.

Truth be told the "re-parse feed" was bolted on to the example afterwards. The main code was written as part of the "DealDroidWithService" example, then it was simplified and the service part removed (because that is a more advanced topic for a later chapter). Then, after the rest, the "re-parse" functionality was added.

Regardless, yeah, it should work as expected. I'll look at it as soon as I can and get it fixed.

Thanks for letting us know about the issue.

charlie.collins

Posts: 125
Registered: 3/8/07
Re: DealDroid - re-parse feed
Posted: Feb 12, 2011 9:06 AM   in response to: plorent in response to: plorent
  Click to reply to this thread Reply

It's fixed in the source now.

Basically the problem was that when the feed was reparsed I was resetting the "items" on the page, but not the spinner/selection. When you reparse it now correctly resets both and takes you back to the "Daily Deals" list of items, and resets the Spinner.

BTW, if you want to really use DealDroid on a device (I do, sometimes it's handy), the DealDroidWithService will automatically re-parse the feed and show you a notification (only when there are new deals). It does this with a background IntentService (and it doesn't leave it the service running either, it uses AlarmManager to run the service at intervals with inexact repeating only when the phone is awake, and it checks for deals, and then kills the service).

charlie.collins

Posts: 125
Registered: 3/8/07
Re: DealDroid - re-parse feed
Posted: Feb 12, 2011 9:08 AM   in response to: charlie.collins in response to: charlie.collins
  Click to reply to this thread Reply

Forgot the link: http://code.google.com/p/android-in-practice/downloads/detail?name=DealDroidWithService.apk

plorent

Posts: 19
From: Netherlands
Registered: 10/2/08
Re: DealDroid - re-parse feed
Posted: Feb 15, 2011 4:40 PM   in response to: charlie.collins in response to: charlie.collins
  Click to reply to this thread Reply

Thanks Charlie! I've seen the DealDroidWithService (worked my way through the other available chapters). And just got an update with new chapters! Perfect timing! Thank you very much.

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff
Manning Developmental Editor