23 posts / 0 new
Last post
markodjokovic
markodjokovic's picture
Offline
Mobile Wizard
Joined: 5 Oct 2010
Posts:
Rss parser with image

If anyone have idea how to make rss parser that will show rss content and next to text show picture from that rss. Something like list box that show text + picture.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Yes, see the RSS parser project at http://www.screencast.com/t/OGU3OGQ3N.

This gives you a class which contains all the properties from the RSS item. Use a MAUI Label for the text, and download the URL to get the data for an image.

michael
michael's picture
Offline
Mobile Conjurer
Joined: 13 Aug 2010
Posts:

May I learn the source code?

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

The source code is with the screen cast. If you look below the video, you will see a tab called 'Attachments' and the source code is in there.

blanco edwardo
ykuoles's picture
Offline
Mobile Wizard
Joined: 9 Jun 2011
Posts:

Hello Sam,
I downloaded the source code and it's so helpful, though it took me days to understand the code. i did some modifications to the code to display certain data in a different way, but I discovered 2 problems that exisit in the original project. First when I click on the screen that contains the rss items the kinetic listbox changes its postition to be at the buttom of the screen. I tried to figure out the reason and I think its from pointerReleaseEvent in RSSItem Widget. The secong problem happens while the details RSS item screen(RSSScreen) is opened. When I click on the screen at the position of the more icon of the previous screen(RSSIndex) more details screens get opened, so am trying to find a way to close or hide the previous screen. Thx Sam for your time, and I hope if you can help me understand and solve these problems.

regards,
Edwardo

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hi Blanco,

With regards to your first point, I'm going to produce an updated version of this project as there are several problems with KineticListBox you've got there.

The second problem (if I understand correctly) is that in RSSScreen, then the buttons from RSSIndex still seem to be active. This is a problem with the widgets still listening to screen events. I don't have that source code available right now, but the problem can be fixed either in the Widget (I seem to remember that there is a custom widget) or in the screen's hide method. If there is a custom widget, then I think that there is a problem in the setEnabled() method, it needs to have a line like this:
if(enabled && !mIsEnabled) // or something similar
{
Environment::getEnvironment()->removePointerListener(this);
}

You need to check that the widgets stop listening to pointer events when they're disabled. If it isn't a custom widget, and the Screen is the listener, then it needs to be something like

void RSSIndex::hide()
{
if(mListening)
{
mListening = false;
Environment::getEnvironment()->removePointerListener(this);
}
}

blanco edwardo
ykuoles's picture
Offline
Mobile Wizard
Joined: 9 Jun 2011
Posts:

thx sam I will try that

blanco edwardo
ykuoles's picture
Offline
Mobile Wizard
Joined: 9 Jun 2011
Posts:

hello Sam,

I just checked the code and there is a RSSItemWidget, is that the custom widget you mean as it has pointer listeners functions, but there is no setEnabled() method. So should the setEnable method be added. And concerning the second option where should the hide method be called??.

thx for your time Sam

Blanco Edwardo

blanco edwardo
ykuoles's picture
Offline
Mobile Wizard
Joined: 9 Jun 2011
Posts:

Hi again Sam

I found that method in RSSWidgetItem class and i think that's the setEnable method you mean I hope you help me with understanding the logic of the code to figure out where the problem is.

void RSSItemWidget::setSelected(bool selected)
{
if(selected)
{
this->setHeight(mTitle->getHeight() + mText->getHeight()+ mSpeaker->getHeight());
mText->setPosition(0, mTitle->getHeight());
mSpeaker->setPosition(0,(mTitle->getHeight()+mText->getHeight()));
}
else
this->setHeight(mTitle->getHeight());

Widget::setSelected(selected);

if(selected)
{
if(!mListening)
{
Environment::getEnvironment().addPointerListener(this);
mListening = true;
}
}
else
{
if(mListening)
{
Environment::getEnvironment().removePointerListener(this);
mListening = false;
}
}
this->getParent()->update();
}

Thx

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Yeah, looking at this, then I think that you need to add this:

void RSSItemWidget::setEnabled(bool enabled)
{
  if(!enabled && mListening)
  {
    Environment::getEnviroment().removePointerListener(this);
    mListening = false;
  }
}

blanco edwardo
ykuoles's picture
Offline
Mobile Wizard
Joined: 9 Jun 2011
Posts:

Thx Sam for you reply. I added the function but the same problem still exists, do i have to add another thing??. I tried another approach which is removing the pointer listener at the pointer relese event of the item widget but my problem now is how to add the listeners back when I come back from the RSSScreen page

blanco edwardo
ykuoles's picture
Offline
Mobile Wizard
Joined: 9 Jun 2011
Posts:

hello again Sam,
After adding the setEnabled method I found that it is not called during running the program, so should I call it some where ??

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hi Edwardo,

When a MAUI Screen displays itself, it calls the setEnabled method on the widgets, and again when it hides, so you shouldn't have to do anything. If you can wait a couple of days I'll produce an updated version, or you can carry on and write some debug out (e.g. lprintfln("RSSItemWidget setEnabled has been called");) and trace through the application.

blanco edwardo
ykuoles's picture
Offline
Mobile Wizard
Joined: 9 Jun 2011
Posts:

Thx Sam for your reply,
I tried that debug out yesterday and found that the function is not called. I added the setEnabled method in the RSSItemWidget Class so do you mean tha it is called automatically when the RSSScreen shows??

Regards,
Blanco Edwardo

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Yeah it should be, its a virtual method on Widget, and should be called every time a screen is shown or hidden. Did you add the setEnabled in the header file as well?

blanco edwardo
ykuoles's picture
Offline
Mobile Wizard
Joined: 9 Jun 2011
Posts:

RSSitemWidget.cpp
void RSSItemWidget::setEnabled(bool enabled)
{
lprintfln("RSSItemWidget setEnabled has been called");
if(!enabled && mListening)
{
Environment::getEnvironment().removePointerListener(this);
mListening = false;
}
}

RSSItemWidget.h
void setEnabled(bool enabled);

I think it's right, isn't it!!!

blanco edwardo
ykuoles's picture
Offline
Mobile Wizard
Joined: 9 Jun 2011
Posts:

I have just found that the setEnabled method is only called when I select between the items in the RSSIndex Screen, but not when the RSSScreen is called.

blanco edwardo
ykuoles's picture
Offline
Mobile Wizard
Joined: 9 Jun 2011
Posts:

Hello Sam,

I still could not solve this problem, and I also do not know why the application works fine with the key events while all the problems happen with the pointer listeners??

blanco edwardo
ykuoles's picture
Offline
Mobile Wizard
Joined: 9 Jun 2011
Posts:

Hello Sam I solved the problem of the screen listeners, but the only problem I have now is with the kineticlist box as it moves to the buttom of the screen when the items it contains doesnt fill the whole screen, but it works fine when the items fill the screen. I checked the new kineticlist box but I couldnt try it because it uses different libraries and my project is built on the old one. But I checked the new class and I found that the problem is with the pointerReleasseEvebt function in the kineticlistbox class as when I comment this line
Environment::getEnvironment().addTimer(this, MS_PER_FRAME, FRAMES+1);
the box does not move to the buttom of the screen but it moves freely as I move the pointer and it gets out of the bounds of the screen. In the new class in the PointerReleaseEvent there are these additional lines
#ifdef
DEBUGTIMERS APPCONTROLLER->makeTimerRequest(new TimerRequest(this, MS_PER_FRAME, FRAMES+1));
#else
Environment::getEnvironment().addTimer(this, MS_PER_FRAME, FRAMES+1); #endif
so I want to know is there a simple way to modify the old class to solve this problem because I donot understand the logic behind these lines of code.

thx for your time

kaqfa
kaqfa's picture
Offline
Joined: 10 Sep 2011
Posts:

Hello I'm a newbie both in MoSync and C++

I got error when try to build and run RSSStarterApp, it's in RSSDownloadQueue.cpp file in

mProcessor = new RSSProcessor();

The error message is:

because the following virtual functions are abstract: RSSDownloadQueue.cpp /RSSStarterApp/Utilities line 24 C/C++ Problem

I've tried to search Google many times, but have no luck yet.
Thank you for the answer.

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hi, a few people have been having this problem recently. Tomorrow, if I do nothing else, I will publish an updated RSSStarterApp. The problem is that the XML processor (MTXml.lib) was changed for the 2.7 release.

I think that the StarterApps may be more popular than I imagined, but people only talk about them when they don't work :-)

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Kaqfa - have a look at this thread as well - http://www.mosync.com/node/7179

kaqfa
kaqfa's picture
Offline
Joined: 10 Sep 2011
Posts:

Thank you for the answer...
I think your RSSstarterApp application is very great in many ways, it's simple and easy to follow, show us many tricks on screen transition and manipulation, utilize both XML and JSon parsing, and off course teaches how to handle http connection.
For those reasons, it's obvious that your application become this popular.
Very big thank you for posting this application source code.

Since I don't understand about the changing in MTxml library, temporarily I'll use MoSync 2.6, and wait for your app update.

Once more, thank you so much.