Hello
I want to create my own RSS Feed for my site.
Searching a tutorial, all ok BUT i can't find how we can add a thumbnail into a row as the picture.
My basic code :
Hope find help !
Regards.
PS : the bitmap is only an example !
I want to create my own RSS Feed for my site.
Searching a tutorial, all ok BUT i can't find how we can add a thumbnail into a row as the picture.
My basic code :
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Parser As SaxParser
Dim web As PhoneIntents
Dim hc As HttpClient
Dim req As HttpRequest
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim RSS As ListView
Dim Title, Link, PubDate, Description As String
Dim Bitmap1 As Bitmap
Bitmap1.Initialize(File.DirAssets, "eri.jpg")
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
RSS.Width = 100%x
RSS.Height = 100%y
Parser.Initialize
hc.Initialize("hc")
req.InitializeGet("http://galaxus.googlenexus.fr/feed")
hc.Execute(req, 1)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause(UserClosed As Boolean)
End Sub
'##########################
'######## Controls ########
'##########################
Sub RSS_ItemClick(Position As Int, Value As Object)
StartActivity(web.OpenBrowser(Value)) 'Open the browser with the link
End Sub
'############################
'######## Fetch Data ########
'############################
Sub hc_ResponseSuccess(Response As HttpResponse, TaskId As Int)
Response.GetAsynchronously("GetRSS", File.OpenOutput(File.DirDefaultExternal, "RSS.xml", False), True, TaskId)
End Sub
Sub hc_ResponseError(Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
If Response <> Null Then
Msgbox("Error: " & Response.GetString("UTF8"), "Connection Error")
Response.Release
End If
End Sub
Sub GetRSS_StreamFinish(Success As Boolean, TaskId As Int)
If Success = False Then
Msgbox(LastException.Message, "Error")
Return
End If
Dim in As InputStream
in = File.OpenInput(File.DirDefaultExternal, "RSS.xml")
Parser.Parse(in, "Parser")
in.Close
End Sub
'##########################
'######## Routines ########
'##########################
Sub Parser_StartElement(Uri As String, Name As String, Attributes As Attributes)
End Sub
Sub Parser_EndElement(Uri As String, Name As String, Text As StringBuilder)
If Parser.Parents.IndexOf("item") > -1 Then
If Name = "title" Then
Title = Text.ToString
Else If Name = "link" Then
Link = Text.ToString
Else If Name = "pubdate" Then
PubDate = Text.ToString
Else If Name = "description" Then
Description = Text.ToString
End If
End If
If Name = "item" Then
RSS.TwoLinesAndBitmap.Label.TextColor = Colors.Black
RSS.TwoLinesAndBitmap.Label.Typeface = Typeface.DEFAULT_BOLD
RSS.TwoLinesAndBitmap.Label.TextSize = 15
RSS.TwoLinesAndBitmap.Label.Gravity = Gravity.CENTER_VERTICAL
RSS.TwoLinesAndBitmap.Label.Height = 50dip
RSS.ScrollingBackgroundColor = Colors.Transparent
RSS.TwoLinesLayout.Label.Gravity = Gravity.LEFT
RSS.TwoLinesLayout.Label.TextSize = 16
RSS.TwoLinesLayout.Label.Height = 200dip
RSS.TwoLinesLayout.Label.Typeface = Typeface.DEFAULT_BOLD
RSS.TwoLinesLayout.Label.TextColor = Colors.Black
RSS.TwoLinesLayout.ItemHeight = 200dip
RSS.TwoLinesLayout.SecondLabel.TextSize = 8dip
RSS.TwoLinesLayout.SecondLabel.Height = 200dip
RSS.AddTwoLinesAndBitmap(Title, Link, Bitmap1)
End If
End Sub
Hope find help !
Regards.
PS : the bitmap is only an example !
Last edited: