RSS Reader Question

72 views
Skip to first unread message

eqali...@gmail.com

unread,
Jan 8, 2014, 8:11:48 AM1/8/14
to codenameone...@googlegroups.com
I am new at codenameone developing and i apologize if the questions have been answered already or if the questions are incorrectly asked.
First question i have is about the RSSReader.I need to add an icon on each RSSEntry.I noticed there should be icons (the iconplaceholder if I am not mistaken :) ) but i don`t see any on the Simulator, i did try a few things but no luck so far.
Unfortunately i have to take images from the feed itself for each entry.I did make changes on the XML of the RSS to see if the XMLparser is reading the RSS as it should ( the RSS is custom made ).Still no luck.
To my question ,does the RSSReader have icons for each RSSEntry ,and if it does what is the best way to switch those icons with images drawn from the Feed for each <item>.If the RSSReader doesn`t have icons ,what is the best way to add them ,drawing the images from the feed itself.
My second question is about RTMP Streaming in CN1 ,is it possible .I noticed there are other protocols that are supported ,but didn`t see RTMP.

Regards.
Radoslav Alexandrov

Shai Almog

unread,
Jan 8, 2014, 12:20:43 PM1/8/14
to codenameone...@googlegroups.com, eqali...@gmail.com
Images are automatically taken from the feed e.g. try the RSS for http://codenameone.blogspot.com/ (don't remember the actual RSS URL), it uses the media tags.
Notice this will only work if you define the icon placeholder to be non-null.

If you want to use it for video the media component might work (depending on the device, we don't test or guarantee this though).

eqali...@gmail.com

unread,
Jan 15, 2014, 6:06:37 AM1/15/14
to codenameone...@googlegroups.com, eqali...@gmail.com
Thanx for the fast answer,and sorry for the delay of my post.It worked ,after taking a look at the xml build of the RSS u gave me , we remade our RSS and it worked .The thing is using the Application of Codenameone for iPhone it does show everything the way we want it to show (exept the Videos but i am still working on that one ) .Now the thing is that i can`t understand if the simulator just doesn`t show them or do i have to define the icon placeholder to be non-null as u sugested.It works perfect on the app builder of codenameone but in the simulator it doesn`t show icons at all.If you can give me  a hint there ,coz after the remake of the RSS (wich i prefer then redoing the parser) it should work just fine.Also here is my media rss feed for the video:<media:content url="http://bnt.bg/file/2014/01/bnt2-20140115-15.01_PLD_Smetki_parno_HEAD.mp4" type="video/mp4">
<media:thumbnail url="http://bnt.bg/file/2014/01/parno-radiator-plovdiv.jpg" width="627" height="351"/>
</media:content> is it correct ?
And another thing i want to ask ,can i use an iFrame .  

Shai Almog

unread,
Jan 15, 2014, 12:52:15 PM1/15/14
to codenameone...@googlegroups.com, eqali...@gmail.com
You need to use a placeholder otherwise the renderer won't leave room for the icon and won't know how to size it properly.
You mean in the RSS stream? I don't see why not as long as you are targeting smartphones only.

eqali...@gmail.com

unread,
Jan 22, 2014, 8:40:48 AM1/22/14
to codenameone...@googlegroups.com, eqali...@gmail.com


On Wednesday, January 15, 2014 7:52:15 PM UTC+2, Shai Almog wrote:
You need to use a placeholder otherwise the renderer won't leave room for the icon and won't know how to size it properly.
You mean in the RSS stream? I don't see why not as long as you are targeting smartphones only.

Seems i am going on this incorrectly. Apologies but i can`t seem to get a placeholder keep the images from the feed ... I presumed it was the setIconPlaceholder() function in the RSSReader,when you suggested to define it i presumed that is what i had to define so i made some experiments and i had no progress at all i found a few forum themes on the matter but still no luck .Then i remembered that the Codenameone app in the apple store does exactly what i want to do (stick the images from the media tags as icons for each particular entry).Can you show me how you did it there.I tried defining a new RSS wich extended the RSSReader but had no luck aswell i think my mistake is in the  making of  the placeholder so the renderer can leave room for the icon .If you can show me how exactly you made it in the Main CodenameApp i would be very greatfull. I should also apologize for  my slow answers and questions on the same topic.Was very busy ,but now this app has my full atention and i will probably ask some  things i can`t do on my own.
By the way  i have to say now that i manage to play a bit more with Codenameone ,you made an incredible thing !
Thanks in advance ,hope i am not to much trouble.  

Shai Almog

unread,
Jan 22, 2014, 1:38:15 PM1/22/14
to codenameone...@googlegroups.com, eqali...@gmail.com
Placed the component in the GUI builder named it feed (root is the parent form) then:

        String url = (String)s.get("url");
        findFeed
(root).setIconPlaceholder(fetchResourceFile().getImage("rss.png"));
        findFeed
(root).setURL(url);


eqali...@gmail.com

unread,
Jan 23, 2014, 7:03:08 AM1/23/14
to codenameone...@googlegroups.com, eqali...@gmail.com
Thanks it worked like a charm and i finally found my mistake ...The entire time i was trying to do it in pure code ,seems i have to turn my attention on the GUI as well.May i ask on the other matter with the Video in the RSS.The feed carries video in a <media:content> tag.We remade our xml as i said in a previous post, now i am thinking of changing the XML to carry the videos in a <media:player> tag ( i found a part of code (below))If i am not mistaken that is what i need and i have to remake the XML again or i am mistaken.If i am mistaken can you point me the right way again .Thank you !
 

if("media:player".equalsIgnoreCase(tag) && "url".equalsIgnoreCase(attributeName)) {
                            current.put("player", value);
                        }

Shai Almog

unread,
Jan 23, 2014, 2:50:11 PM1/23/14
to codenameone...@googlegroups.com, eqali...@gmail.com
This should work from code too so I'm not sure what you ran into.

We just show the HTML that's associated with the RSS in a web component. For a youtube RSS this actually works great since the HTML returned contains a video component that works even on mobile browsers. We don't look at the video media XML attribute at the moment but if you have suggestions to extend the RSSReader to suite your needs we are open to suggestions.
Reply all
Reply to author
Forward
0 new messages