开发者

How can i get link elements with the feed framework (libs-for-android)

For a project we use the feed framework libs-开发者_StackOverflowfor-android. The demo is very good but we can't find out how to grab the link elements in the feed. We try

private static final String[] PROJECTION = {
            Entries._ID, Entries.TITLE_PLAINTEXT, Entries.SUMMARY, Entries.CONTENT,
            Entries.ALTERNATE_HREF, Links.HREF
    };

but Links.HREF is null. Does anyone have a suggestion? The xml can you find here (Atom feed)


Short answer: Does Entries.ALTERNATE_HREF contain the value you're looking for?

Long answer: The columns in the projection must all come from a single table (in this case, Entries). Cursors are flat, so to access nested elements the caller must either perform a second query, or pack child elements into a string or blob column. Another option is to define a column like ALTERNATE_HREF, which is basically just shorthand for the href attribute of the first rel="alternate" link element. There are a couple more columns like this defined in AtomContract, including Entries.ENCLOSURE_HREF and Entries.RELATED_HREF, but you might need to write your own AtomContract and AtomContentHandler if the data you need is not exposed.


The answer is the "short answer". I write my own AtomContract and now the link is stored in Entries.ALTERNATE_HREF

Thanks libs-for-android!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜