Bugfix: Feed Attribute wasn't set when items where loaded from DB

This commit is contained in:
Daniel Oeh 2012-04-14 15:00:13 +02:00
parent 654cff51c8
commit 954b6edf36
2 changed files with 5 additions and 2 deletions

View File

@ -46,6 +46,8 @@ public class ItemviewActivity extends SherlockActivity {
}
Feed feed = manager.getFeed(feedId);
item = manager.getFeedItem(itemId, feed);
Log.d(TAG, "Title of item is " + item.getTitle());
Log.d(TAG, "Title of feed is " + item.getFeed().getTitle());
}
private void populateUI() {

View File

@ -199,7 +199,7 @@ public class FeedManager {
// Get FeedItem-Object
Cursor itemlistCursor = adapter.getAllItemsOfFeedCursor(feed);
feed.setItems(extractFeedItemsFromCursor(context, itemlistCursor));
feed.setItems(extractFeedItemsFromCursor(context, feed, itemlistCursor));
feeds.add(feed);
}while(feedlistCursor.moveToNext());
@ -207,7 +207,7 @@ public class FeedManager {
adapter.close();
}
private ArrayList<FeedItem> extractFeedItemsFromCursor(Context context, Cursor itemlistCursor) {
private ArrayList<FeedItem> extractFeedItemsFromCursor(Context context, Feed feed, Cursor itemlistCursor) {
ArrayList<FeedItem> items = new ArrayList<FeedItem>();
PodDBAdapter adapter = new PodDBAdapter(context);
adapter.open();
@ -216,6 +216,7 @@ public class FeedManager {
FeedItem item = new FeedItem();
item.id = itemlistCursor.getLong(itemlistCursor.getColumnIndex(PodDBAdapter.KEY_ID));
item.setFeed(feed);
item.setTitle(itemlistCursor.getString(itemlistCursor.getColumnIndex(PodDBAdapter.KEY_TITLE)));
item.setLink(itemlistCursor.getString(itemlistCursor.getColumnIndex(PodDBAdapter.KEY_LINK)));
item.setDescription(itemlistCursor.getString(itemlistCursor.getColumnIndex(PodDBAdapter.KEY_DESCRIPTION)));