B4A Library CustomRSSView

This library will allow you to display RSS feeds "Magazine Style" on a nice custom view.

Requirements:

- B4A 3.8

- Internet connection

How to install:

- Copy the CustomRSSView.jar and CustomRSSView.xml to your additional libraries directory.

Usage:

B4X:
Private rssView As CustomRSSView

'Initialize the CustomRSSView
rssView.Initialize(Activity, Me, "rssView", 50dip, 100%y - 50dip)

'Enter the URL of the RSS feed you want to parse
rssView.ParseRSS("http://www.b4x.com/android/forum/forums/-/index.rss")

If you want to parse local feeds, do this:
B4X:
rssView.ParseOfflineRSS(File.DirAssets, "MagazineStyleTemplate.xml")

That's it!


Notes:

1- This library process only valid XML feeds and extracts the following fields: Title, Author, Description, Link, Image and PubDate.

2- If you want to parse XML feeds which might not be compliant or you want to extract other fields you will have to do it yourself and add the data to the view, there's a method to do that.

3- On some Android versions the images might not show. - Fixed.

4- Included a simple XML template to create a magazine style feed.


Check the attached sample for more details.


Screenshots:


zAaTzPXl.png



BlxFkdVl.jpg



mCcbp2ll.jpg
 

Attachments

  • CustomRSSView_Sample.zip
    12.3 KB · Views: 610
  • CustomRSSView_Lib_1.4.zip
    14.3 KB · Views: 578
Last edited:

Douglas Farias

Expert
Licensed User
Longtime User
yes is my forum problem thx, about your problem really your panel is not correct need - pnlaction.height
but the lib have a problem too only go show full if you use 0%y and 100%Y
if u add your panel at a scrool view u can see what i say xD

u need to talk with nj to add option to setlayout *-* or add blank lines at the end of all parse
 

jdiperla

Member
Licensed User
Longtime User
I didn't see this anywhere..But for rssView_ItemClicked, can we do more than just grab the URL? Can we grab things like GUID, Title, Author or even a custom field? If so, how? If not, is this planned? Thanks!

____

EDIT: I was also curious if we can limit how many news articles are displayed and if there was a way to do a next and previous page if that were the case. The last request/question I had on this was if there are ways to sort how the RSS news feed is presented. If these features are unavailable, I would like to make a formal request for them. A donation will be coming your way within the next day or two. Thank you NJDude!
 
Last edited:

NJDude

Expert
Licensed User
Longtime User
The _ItemClicked event only passes the URL of the RSS article which is in the RSS feed itself, what you are asking is not possible. Regarding the number of articles displayed and pagination, you could handle that yourself, the RSSView just displays the feed as is, the features you're requesting are more towards a RSS reader which this library is not.
 

Alisson

Active Member
Licensed User
Hello guys.

I am using the CustomRss library to read an online XML file.
After I download the file using the code.

B4X:
rssView.Initialize(Activity, Me, "rssView", 44dip, 100%y - 0dip)
rssView.ParseRSS("http://www.site.com/rss.xml")
link1 = "http://www.site.com/rss.xml"
               
Dim job3 As HttpJob
            job3.Initialize("rss", Me)
               job3.Download(link1)

When access a second view , the view of RSS appears.
I'm using Activity.Finish correctly.



My second code to download file:

B4X:
Sub JobDone (Job As HttpJob)
   If Job.Success = True Then
       Job.Download(link1)
           Dim out As  OutputStream
          out = File.OpenOutput(File.DirRootExternal,"folder/rss.xml",False)
           File.Copy2(Job.GetInputStream,out)
           out.Close
           Job.Release
   End If
   ProgressDialogHide
End Sub

When clicked to accsses the second view:

B4X:
Sub btn_Click
    StartActivity("online2")
    Activity.Finish
End Sub

My module online2 and view three, online:

B4X:
...
Activity.LoadLayout("online")
...


If I access the online view , returns the view RSS reading rss.
Please help me.
Long time I'm trying to find the error and not against .

Thanks very much!
 
Last edited:

NJDude

Expert
Licensed User
Longtime User
If you want to parse an online RSS you only need:
B4X:
rssView.Initialize(Activity, Me, "rssView", 44dip, 100%y - 0dip)
rssView.ParseRSS("http://www.site.com/rss.xml")
You don't have to download it.
 

Alisson

Active Member
Licensed User
NJDUde the library is used to an online RSS parse .
But I need to download the XML file. If a person is offline it can read RSS.
I have downloaded the problem. If you use the code to download the module and RSS view are reset when you access a new view.
Example, accsses the view to read RSS, after access teh view contacts. The view RSS overrides the contacts.
Sorry, can't post the project because it is for corporate / company.
Please, look my log:

upload_2016-6-1_9-38-29.png


I need to solve this problem just to finish the project .

NJDUde, thanks for the feedback.
 

Attachments

  • upload_2016-6-1_9-35-2.png
    upload_2016-6-1_9-35-2.png
    170 KB · Views: 148

NJDude

Expert
Licensed User
Longtime User
The information you posted is not telling me anything, however, for what you just mentioned, if you want to show an RSS even if offline then you should:

1- Check for internet connection.
2- If connected then download and parse.
3- if not connected then parse the previously downloaded RSS.

or

1- Check for internet connection.
2- If connected then download and parse.
3- If not connected then display a message to connect to the internet or try later.

I hope that helps.
 
Top