B4A Library CustomRSSView

NJDude

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








 

Attachments

Last edited:

NJDude

Expert
Licensed User
I mentioned that on the notes above. It's a bug on certain versions of Android, (I'll have to find a fix).

Just curious, what Android version you have?
 
Last edited:

asales

Well-Known Member
Licensed 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

Well-Known Member
Licensed 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
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
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.
 

joop

Active Member
Licensed 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
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
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
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
Thanks NJDude i've got it working now , in the XML-file and with AddToRSSView .
 
Top