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: 605
  • CustomRSSView_Lib_1.4.zip
    14.3 KB · Views: 573
Last edited:

asales

Expert
Licensed User
Longtime User
Very cool but I don't see the pictures in the offline sample. Only Title, Author, Description, Link and PubDate.
 

Attachments

  • rssview_sample2.png
    rssview_sample2.png
    31.3 KB · Views: 336

asales

Expert
Licensed User
Longtime User
I tested in Galaxy Player with Android 2.3.6 and Sony Xperia Mini with 4.0.4.
The size of images is big. Could not be the problem?
 

asales

Expert
Licensed User
Longtime User
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.

Hi NJDude.

How I can do this?
 

eSolution

Member
Licensed User
Longtime User
NJDude, there is a doc with all the methods of the library? :D How can I modify the design if I want to? (may be colors, backgrounds, fonts size and so on...) I love what the lib can do and it solved in 20 min a problem that I tried to solve in the last 3 weeks using other app making software ... B4A is so far the most versatile solution and the community is awesome!! :D
 

NJDude

Expert
Licensed User
Longtime User
The intellisense will show all the available methods, they are pretty much self explanatory, regarding modifying the design, that depends on how the XML is created, the sample shows the most common one, and the XML included is the "Magazine Style", other than that, just the colors can be changed (fonts, and backgrounds), it's just a simple RSS view.
 

asales

Expert
Licensed User
Longtime User
The new version attached to the first post will allow you to define those fields.

Thanks. Excelent.
Another suggestion for future versions: possibility of change the text size of field Title.
 

joop

Active Member
Licensed User
Longtime User
Works great .

NJdude ,is it possible to load an image from File.DirAssets , instead from
a web link with this lib ,so it can be used when there is no internet available.

Or can this be done with rssView.AddToRSSView("","","test.png","","","")
or something like that ?
 

NJDude

Expert
Licensed User
Longtime User
Yes, you can do something like this:
B4X:
...

MyPic = "file:///android_asset/test.png"

...

rssView.AddToRSSView("", "", MyPic, "", "", "")
Note that the image names MUST be all lowercase.
 
Last edited:

joop

Active Member
Licensed User
Longtime User
Thanks ! , I tried AddToRSSView but I think I am doing something wrong ..

B4X:
Sub ParseOfflineButton_Click

Dim Mypic As String
Mypic = "file:///android_asset/test.jpg"


    ProgressDialogShow("Fetching...")

                'Enter the direcrory and file name of the feed to parse
                rssView.ParseOfflineRSS(File.DirAssets, "magazinestyletemplate.xml")
                rssView.AddToRSSView("","",Mypic,"","","")
       
End Sub

It gives a Runtime Exeption Object should first be initialized (List).
 

NJDude

Expert
Licensed User
Longtime User
You need to "prepare" the view to receive data, and then show it:
B4X:
rssView.PrepareRSSView

rssView.AddToRSSView("","",Mypic,"","","")

rssView.ShowRSSView
If you want to parse the XML in assets then the reference to ALL the pictures in the XML should be file:///android_asset/<PIC_NAME>, what you have done will not work.
 

joop

Active Member
Licensed User
Longtime User
Thanks NJDude i've got it working now , in the XML-file and with AddToRSSView .
 
Top