Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 32
Registered: ‎10-19-2011
My Device: 8520
My Carrier: Gustavo

creating rss reader Help

hi I'm doing a rss reader of a certain page, I think my concecion with the web.

 

but what is not is like bringing the image and the content had. an example of what I do is this:

 

Capture8_47_47.jpg 

 

this is my code:

import java.io.IOException;
import java.io.InputStream;
import javax.microedition.io.*;
import javax.microedition.rms.RecordEnumeration;
import net.rim.blackberry.api.browser.Browser;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import org.xml.sax.*;
import net.rim.device.api.xml.parsers.*;

import org.w3c.dom.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/*
import net.rim.device.api.system.*;
import java.util.Vector;
import javax.microedition.rms.RecordComparator;
import javax.microedition.rms.RecordFilter;*/



class XML_Parsing_Sample extends UiApplication{
//creating a member variable for the MainScreen
MainScreen _screen= new MainScreen();
//string variables to store the values of the XML document
String _node,_element;
Connection _connectionthread;
// private members - these represent the "controls"
private LabelField statusField = null;
private ListField feedList = null;
private RecordEnumeration feeds = null;
private int[] feedIds = null;
private int[] itemIds = null;
private int mode = 0; // 0 is feeds, 1 is items

public static void main(String arg[]){
XML_Parsing_Sample application = new XML_Parsing_Sample();
//create a new instance of the application
//and start the application on the event thread
application.enterEventDispatcher();
}

public XML_Parsing_Sample() {
_screen.setTitle("DrblackBerry Lector RSS");//setting title
_screen.add(new RichTextField("Cargando....."));
_screen.add(new SeparatorField());
pushScreen(_screen); // creating a screen
//creating a connection thread to run in the background
_connectionthread = new Connection();
_connectionthread.start();//starting the thread operation
}

/*public void updateField(String node, String element){
//receiving the parsed node and its value from the thread
//and updating it here
//so it can be displayed on the screen
String title="Title";
_screen.add(new RichTextField(node+" : "+element));

if(node.equals(title)){
_screen.add(new SeparatorField());
}
}*/

private class Connection extends Thread{
public Connection(){
super();
}

public void run(){
String rssUrl = "http://feeds.feedburner.com/Drblackberrycomve?format=xml";
InputStream inputStream = null;
HttpConnection httpConnection = null;

try {

// conectarse a la URL del feed
httpConnection = (HttpConnection)Connector.open(rssUrl);
inputStream = httpConnection.openDataInputStream();

// Si la conecion es Buena
if(httpConnection.getResponseCode() == HttpConnection.HTTP_OK)
{
Dialog.inform("Se conecto bn ");
_screen.add(new RichTextField("se coneto a la internet....."));
pushScreen(_screen);


// ver el campo de encabezado de una codificación específica
String desiredEncoding = "ISO-8859-1"; //iso-8859-1
String contenttype = httpConnection.getHeaderField("Content-Type");
if (contenttype != null)
{
contenttype = contenttype.toUpperCase();
if (contenttype.indexOf("UTF-8") != -1)
{
desiredEncoding = "UTF-8";
}
}

// necesitamos una fuente de entrada para el analizador SAX
InputSource is = new InputSource(inputStream);

// la configuración de codificación para que coincida con lo que el servidor web nos ha enviado
is.setEncoding(desiredEncoding);

// creamos el factory
SAXParserFactory factory = SAXParserFactory.newInstance();

// creamos el parser
SAXParser parser = factory.newSAXParser();

// una instancia RSSHandler
RSSHandler myHandler= new RSSHandler();

// perform the synchronous parse
parser.parse(is,myHandler);
}
}



catch (IOException ioe)
{
System.err.println("IO Exception !: " + ioe.getMessage());
ioe.printStackTrace();
}
catch (SAXException saxe)
{
System.err.println("SAX Exception !: " + saxe.getMessage());
saxe.printStackTrace();
}
catch (Exception e)
{
System.err.println("General Error " + e.getMessage());
e.printStackTrace();
}

}

}
class LinkLabel extends LabelField
{
String mUrl = "";
private Object rssUrl;
public LinkLabel(String title, String url) {
super(title, FOCUSABLE);
mUrl = url;
}

protected boolean navigationClick(int status, int time) {
Browser.getDefaultSession().displayPage(mUrl);
return true;
}
 }

}

 

this is my DefaultHandler

 


import net.rim.device.api.util.Arrays;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;


class RSSHandler extends DefaultHandler {
boolean isItem = false;
boolean isTitle = false;
boolean isLink = false;
boolean isDescri = false;
boolean isDate = false;
boolean isCategoria = false;

String[] title = new String[] {};
String[] link = new String[] {};
String[] descri = new String[]{};
String[] date = new String[]{};
String[] categoria = new String[]{};

String value = "";

public void startElement(String uri, String localName, String name,
Attributes attributes) throws SAXException {
if (!isItem) {
if (name.equalsIgnoreCase("item"))
isItem = true;
} else {
if (name.equalsIgnoreCase("title"))
isTitle = true;
if (name.equalsIgnoreCase("link"))
isLink = true;
}
}

public void characters(char[] ch, int start, int length)
throws SAXException {
if (isTitle || isLink)
value = value.concat(new String(ch, start, length));
}

public void endElement(String uri, String localName, String name)
throws SAXException {
if (isItem && name.equalsIgnoreCase("item"))
isItem = false;
if (isTitle && name.equalsIgnoreCase("title")) {
isTitle = false;
Arrays.add(title, value);
value = "";
}
if (isLink && name.equalsIgnoreCase("link")) {
isLink = false;
Arrays.add(link, value);
value = "";
}
if (isDescri && name.equalsIgnoreCase("description")) {
isDescri = false;
Arrays.add(descri, value);
value = "";
}
if (isCategoria && name.equalsIgnoreCase("category")) {
isCategoria = false;
Arrays.add(categoria, value);
value = "";
}
if (isDate && name.equalsIgnoreCase("pubDate")) {
isDate = false;
Arrays.add(date, value);
value = "";
}
}

Developer
Posts: 17,019
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: creating rss reader Help

i would suggest to use a listfield
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
Posts: 32
Registered: ‎10-19-2011
My Device: 8520
My Carrier: Gustavo

Re: creating rss reader Help

but when have the image as I do?
Developer
Posts: 17,019
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: creating rss reader Help

i don't understand your question.
your code does not show any images.
rss usually contains links to images, you'll have to download them separately.

if you create a bean object for every entry you can download the picture asynchronically and add it later, the listfield will then display the image.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
Posts: 32
Registered: ‎10-19-2011
My Device: 8520
My Carrier: Gustavo

Re: creating rss reader Help

[ Edited ]

Hey hey look at this new method implemented and gives me error, I can help correct

 

import java.io.IOException;
import java.io.InputStream;
import javax.microedition.io.*;
import javax.microedition.rms.RecordEnumeration;
import net.rim.blackberry.api.browser.Browser;
import net.rim.device.api.browser.field.CloseEvent;
import net.rim.device.api.browser.field2.BrowserField;
import net.rim.device.api.system.Characters;
import net.rim.device.api.system.EncodedImage;
import net.rim.device.api.system.GlobalEventListener;
import net.rim.device.api.system.KeyListener;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;

import org.xml.sax.*;
import net.rim.device.api.xml.parsers.*;

import org.w3c.dom.*;

import com.rss.confi.DrRssFeed;
import com.rss.confi.DrRssItem;

/*
import net.rim.device.api.system.*;*/
import java.util.Vector;
import javax.microedition.rms.RecordComparator;
import javax.microedition.rms.RecordFilter;
import javax.microedition.rms.RecordStore;



class XML_Parsing_Sample extends UiApplication{
    //creating a member variable for the MainScreen
    MainScreen _screen= new MainScreen();
    //string variables to store the values of the XML document
    String _node,_element;
    Connection _connectionthread;
    // private members - these represent the "controls"
   private LabelField statusField = null;
    private ListField feedList = null;
    private RecordEnumeration feeds = null;
    private int[] feedIds = null;
    private int[] itemIds = null;
    private int mode = 0;               // 0 is feeds, 1 is items
    private RecordStore store;
    String rssUrl = "http://feeds.feedburner.com/Drblackberrycomve?format=xml";
    confi rss = new confi();
    
    
	protected Manager contenedor;

    public static void main(String arg[]){
        XML_Parsing_Sample application = new XML_Parsing_Sample();
        //create a new instance of the application
        //and start the application on the event thread
        application.enterEventDispatcher();
        
    }

    public XML_Parsing_Sample() {
       _screen.setTitle("DrblackBerry Lector RSS");//setting title
       //  EncodedImage cap= EncodedImage.getEncodedImageResource( "img/banner.png"); 
       //	_screen.add( new BitmapField(cap.getBitmap(),BitmapField.FIELD_HCENTER)); 
        _screen.add(new RichTextField("Cargando....."));
        _screen.add(new SeparatorField());
        pushScreen(_screen); // creating a screen
        //creating a connection thread to run in the background
      _connectionthread = new Connection();
       _connectionthread.start();//starting the thread operation
      // setupdata();
      // addKeyListener(new RssKeyListener());
      // UiApplication.getUiApplication().addGlobalEventListener((GlobalEventListener) this);
       
		//agregarNoticia(null);
		 
    }

     
	

	private class Connection extends Thread{
        public Connection(){
            super();
        }

        public void run(){
        	
            InputStream inputStream = null;
            HttpConnection httpConnection = null;

            try {
                    
                    // conectarse a la URL del feed
                    httpConnection = (HttpConnection)Connector.open(rssUrl);
                    inputStream = httpConnection.openDataInputStream();
                    
                    // Si la conecion es Buena
                    if(httpConnection.getResponseCode() == HttpConnection.HTTP_OK)
                    {
                    	Dialog.inform("Se conecto bn ");
                    	  _screen.add(new RichTextField("se coneto a la internet....."));
                    	  pushScreen(_screen); 
                    	  
                    	
                        // ver el campo de encabezado de una codificación específica
                        String desiredEncoding = "ISO-8859-1";  //iso-8859-1
                        String contenttype = httpConnection.getHeaderField("Content-Type");
                        if (contenttype != null)
                        {
                            contenttype = contenttype.toUpperCase();
                            if (contenttype.indexOf("UTF-8") != -1)
                            {
                                desiredEncoding = "UTF-8";
                            }
                        }

                        // necesitamos una fuente de entrada para el analizador SAX
                        InputSource is = new InputSource(inputStream);

                        // la configuración de codificación para que coincida con lo que el servidor web nos ha enviado
                        is.setEncoding(desiredEncoding);
                        
                        // creamos el factory
                        SAXParserFactory factory = SAXParserFactory.newInstance();
            
                        // creamos el parser
                        SAXParser parser = factory.newSAXParser();
                        
                        // una instancia RSSHandler
                       RSSHandler myHandler= new RSSHandler();

                        // perform the synchronous parse           
                       parser.parse(is,myHandler);
                    }
                }
                
            
            
            catch (IOException ioe)
            {
                System.err.println("IO Exception !: " + ioe.getMessage());
                ioe.printStackTrace();
            }
            catch (SAXException saxe)
            {
                System.err.println("SAX Exception !: " + saxe.getMessage());
                saxe.printStackTrace();
            }
            catch (Exception e)
            {
                System.err.println("General Error " + e.getMessage());
                e.printStackTrace();
            }
            
        }

    }
  	
	private void setupdata()
    {
        mode = 0;
        feeds = rss.getFeedList();
        feedIds = new int[feeds.numRecords()];
        int i = 0;
        try
        {
            while (feeds.hasNextElement())
            {
                feedIds[i++] = feeds.nextRecordId();
            }
        }
        catch (Exception e)
        {
            System.err.println("Error enumerating Feeds " + e.getMessage());
        }
     }
	
	
	// metodo el cual usasmos para cargar los datos a mostrar
	
  private void loadFeed(int feedIndex)
    {
	  
        System.out.println("Got a feed [" + feedIndex + "]");
        DrRssFeed thisFeed = rss.createFeed(rss.getRecord(feedIds[feedIndex]));

        statusField.setText(thisFeed.getName());
        
        System.out.println(thisFeed.getName());
        System.out.println(thisFeed.getUrl());

        RecordEnumeration items = rss.getFeedItems(thisFeed.getName());
        itemIds = new int[items.numRecords()];
        int i = 0;
        try
        {
            while (items.hasNextElement())
            {
                itemIds[i++] = items.nextRecordId();
            }
        }
        catch (Exception e)
        {
            System.err.println("Error enumerating items in feed [" + thisFeed.getName() + "] " + e.getMessage());
        }
        mode = 1;
        if (items.numRecords() > 0)
        {
            feedList.setSelectedIndex(0);
        }
        feedList.setSize(items.numRecords());
        feedList.invalidate();
    }
  
  private void showItem(int itemIndex)
  {
	  DrRssItem thisItem = rss.createItem(rss.getRecord(itemIds[itemIndex]));
      
      System.out.println(thisItem.getTitle());
      System.out.println(thisItem.getLink());
      
      try
      {
          RssDescription descScreen = new RssDescription(thisItem);
          UiApplication.getUiApplication().pushScreen(descScreen);
      }
      catch (Exception e)
      {
          System.err.println("Failed to launch link: " + e.getMessage());
          e.printStackTrace();
      }
  }
  
  /**/
  
  public void drawListRow(ListField listField,Graphics graphics,int index,int y,int width)
  {
      graphics.setFont(Font.getDefault());
      if (mode == 0)
      {
    	  DrRssFeed thisFeed = rss.createFeed(rss.getRecord(feedIds[index]));
          graphics.drawText(thisFeed.getName(),2,y,DrawStyle.TOP,width);
      }
      else
      {
    	  DrRssItem thisItem = rss.createItem(rss.getRecord(itemIds[index]));
          graphics.drawText(thisItem.getTitle(),2,y,DrawStyle.TOP,width);
      }
  }

  public int getPreferredWidth(ListField listField)    
  {
      return Graphics.getScreenWidth();
  }
  public Object get(ListField listField,int index)
  {
      return null;
  }
  
  public int indexOfList(ListField listField,String prefix,int start)
  {
      return 0;
  }
  /**/
  
  class RssDescription extends FullScreen implements FieldChangeListener
  {
	  DrRssItem _item;
      ButtonField cancelButton = null;
      ButtonField linkButton = null;
      
      RssDescription(DrRssItem item)
      {
          super(Manager.VERTICAL_SCROLL);
          _item = item;
          
          
          //setTitle(item.getTitle());
          LabelField desc = new LabelField(item.getDescription());
          add(desc);
          cancelButton = new ButtonField("Cancel");
          cancelButton.setChangeListener(this);
          add(cancelButton);
          linkButton = new ButtonField("Full Story");
          linkButton.setChangeListener(this);
          add(linkButton);
      }
      
	public boolean onClose()
      {
          close();
          return true;
      }
      public void fieldChanged(Field field,int context)
      {
          if (context != FieldChangeListener.PROGRAMMATIC)
          {
              if (field == cancelButton)
              {
                  onClose();
              }
              if (field == linkButton)
              {
                  Browser.getDefaultSession().displayPage(_item.getLink());
              }
          }
      }
           
  }
  
  /**/
  
  class RssKeyListener implements KeyListener
  {
      public boolean keyChar(char key, int status, int time)
      {
          if (key == Characters.ENTER)
          {
              if ( mode == 0)
              {
                  loadFeed(feedList.getSelectedIndex());
              }
              else
              {
                  showItem(feedList.getSelectedIndex());
              }
              return true;
          }
          if (key == Characters.ESCAPE)
          {
              if (mode == 0)
              {
                 
              }
              else
              {
                 
              }
              return true;
          }     
          return false;   
      }
      public boolean keyDown(int keycode,int time)
      {
          return false;
      }
      public boolean keyUp(int keycode,int time)
      {
          return false;
      }
      public boolean keyRepeat(int keycode,int time)
      {
          return false;
      }
      public boolean keyStatus(int keycode,int time)    
      {
          return false;
      }
  }


  
  
}

 

it is my XML PARSE

import net.rim.device.api.util.Arrays;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;


 class RSSHandler extends DefaultHandler {
        boolean isItem = false;
        boolean isTitle = false;
        boolean isLink = false;
        boolean isDescri = false;
        boolean isDate = false;
        boolean isCategoria = false;
        
        String[] title = new String[] {};
        String[] link = new String[] {};
        String[] descri = new  String[]{};
        String[] date = new  String[]{};
        String[] categoria = new  String[]{};
        
        String value = "";

        public void startElement(String uri, String localName, String name,
                Attributes attributes) throws SAXException {
            if (!isItem) {
                if (name.equalsIgnoreCase("item"))
                    isItem = true;
            } else {
                if (name.equalsIgnoreCase("title"))
                    isTitle = true;
                if (name.equalsIgnoreCase("link"))
                    isLink = true;
            }
        }

        public void characters(char[] ch, int start, int length)
                throws SAXException {
            if (isTitle || isLink)
                value = value.concat(new String(ch, start, length));
        }

        public void endElement(String uri, String localName, String name)
                throws SAXException {
            if (isItem && name.equalsIgnoreCase("item"))
                isItem = false;
            if (isTitle && name.equalsIgnoreCase("title")) {
                isTitle = false;
                Arrays.add(title, value);
                value = "";
            }
            if (isLink && name.equalsIgnoreCase("link")) {
                isLink = false;
                Arrays.add(link, value);
                value = "";
            }
            if (isDescri && name.equalsIgnoreCase("description")) {
            	isDescri = false;
                Arrays.add(descri, value);
                value = "";
            }
            if (isCategoria && name.equalsIgnoreCase("category")) {
            	isCategoria = false;
                Arrays.add(categoria, value);
                value = "";
            }
            if (isDate && name.equalsIgnoreCase("pubDate")) {
            	isDate = false;
                Arrays.add(date, value);
                value = "";
            }
        }
    }

 

 this is my method

 

import java.util.Vector;

import javax.microedition.rms.RecordComparator;
import javax.microedition.rms.RecordEnumeration;
import javax.microedition.rms.RecordFilter;
import javax.microedition.rms.RecordStore;




import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.ListField;



public class confi {
	
	  /* private LabelField statusField = null;
	    private ListField feedList = null;
	    private RecordEnumeration feeds = null;
	    private int[] feedIds = null;
	    private int[] itemIds = null;
	    private int mode = 0;  */             // 0 is feeds, 1 is items
	    private RecordStore store;
	
	public RecordEnumeration getFeedList()
	  {

	      RSSFilter feedsFilter = new RSSFilter("H",null);
	      RecordEnumeration feeds = null;

	      try
	      {
	          feeds = store.enumerateRecords(feedsFilter,feedsFilter,false);
	          return feeds;
	      }
	      catch (Exception e)
	      {
	          System.err.println("Error getting FeedList [" + e.getMessage() + "]");
	      }
	      return null;
	  }
	    
	  public byte[] getRecord(int recId)
	  {
	      try
	      {
	        
			return store.getRecord(recId);
	      }
	      catch (Exception e)
	      {
	          System.err.println("Error in getRecord[" + recId + "] " + e.getMessage());
	          return null;
	      }
	  }
	    
	  public DrRssFeed createFeed(String name,String url)
	  {
	      return new DrRssFeed(name,url);
	  }
	  
	  public DrRssFeed createFeed(byte[] recordData)
	  {
	      return createFeed(new String(recordData));
	  }
	  public DrRssFeed createFeed(String recordData)
	  {
	      Vector v = Utils.split(recordData,"|");
	      DrRssFeed feed = new DrRssFeed();
	      feed.setName((String) v.elementAt(1));
	      feed.setUrl((String)v.elementAt(2));
	      return feed;
	      
	  }
	    
	    
	    // metodo con el traemos el nombre y la url la cual se mostrar al inicio.
	    public class DrRssFeed
	    {
	        private String _name;
	        private String _url;
	        
	        DrRssFeed()
	        {
	        }
	    
	    
	        DrRssFeed(String name,String url)
	        {
	            _name = name;
	            _url = url;
	        }
	    
	       
	        public String getName()
	        {
	            return _name;
	        }
	        
	        public String getUrl()
	        {
	            return _url;
	        }
	         
	         
	        public void setName(String name)
	        {
	            _name = name;
	        } 
	        
	        public void setUrl(String url)
	        {
	            _url = url;
	        }
	       
	        public String toString()
	        {
	            String ret = "H|";
	            ret += _name;
	            ret += "|" + _url;
	            return ret;
	        }
	    }
	    
	    public RecordEnumeration getFeedItems(String feedname)
	    {

	        RSSFilter feedsFilter = new RSSFilter("D",feedname);
	        RecordEnumeration titles = null;

	        try
	        {
	            titles = store.enumerateRecords(feedsFilter,feedsFilter,false);
	            return titles;
	            
	        }
	        catch (Exception e)
	        {
	            System.err.println("Error getting FeedTitles [" + e.getMessage() + "]");
	        }
	        return null;
	    }
	   
	    
	    public static class RSSFilter implements RecordFilter, RecordComparator 
	    {
	        private String _type = "";
	        private String _name = "";
	        
	        RSSFilter(String type,String name)
	        {
	            _type = type;
	            _name = name;
	        }
	        
	        public boolean matches( byte[] recordData )
	        {
	            try
	            {
	                String oneRec = new String(recordData);
	                Vector v1 = Utils.split(new String(recordData),"|");
	                
	                
	                String recordType = (String) v1.elementAt(0);
	                String recordName = (String) v1.elementAt(1);
	                   
	                   
	                   
	                if (_name != null)   
	                {
	                    if (recordName.trim().equalsIgnoreCase(_name) && recordType.equalsIgnoreCase(_type))
	                    {
	                      //  System.out.println("Found Matching Record 1");
	                        return true;
	                    }
	                }
	                else
	                {
	                    // just matching type
	                    if (recordType.equalsIgnoreCase(_type))
	                    {
	                    //   System.out.println("Found Matching Record 2");
	                        return true;
	                    }
	                }
	            }
	            catch (Exception e)
	            {
	                System.out.println(e);
	                e.printStackTrace();
	            }
	            return false;
	        }
	        
	        
	        public int compare(byte[] rec1, byte[] rec2)
	        {
	            int comp = 0;
	            
	            try
	            {

	                String first = new String(rec1);
	                String second = new String(rec2);
	                Vector v1 = Utils.split(first,"|");
	                Vector v2 = Utils.split(second,"|");
	                if (_type.equals("H"))
	                {
	                    //compare name field
	                    String r1 = ((String) v1.elementAt(1)).toUpperCase();
	                    String r2 = ((String) v2.elementAt(1)).toUpperCase();
	                    comp = r1.compareTo(r2);
	                }
	                else
	                {
	                    // compare title field
	                    String r1 = ((String) v1.elementAt(2)).toUpperCase();
	                    String r2 = ((String) v2.elementAt(2)).toUpperCase();
	                    comp = r1.compareTo(r2);
	                }
	                
	            }
	            catch (Exception e)
	            {                
	            }
	            
	            if(comp < 0)
	            {
	                return PRECEDES;
	            }
	            else if( comp == 0 )
	            {
	                return EQUIVALENT;
	            }
	            else
	            {
	                return FOLLOWS;
	            }
	        }
	     }   
	    
	    
	    /**/
	    
	    public DrRssItem createItem(byte [] recordData)
	     {
	         return createItem(new String(recordData));
	     }
	     
	     
	     public  DrRssItem createItem(String recordData)
	     {
	         Vector v = Utils.split(recordData,"|");
	         DrRssItem ret = new DrRssItem();
	         ret.setName((String) v.elementAt(1));
	         ret.setTitle((String) v.elementAt(2));
	         ret.setLink((String) v.elementAt(3));
	         ret.setDescription((String) v.elementAt(4));
	         ret.setCategory((String) v.elementAt(5));
	         ret.setPubDate((String) v.elementAt(6));
	         return ret;
	     }
	     
	     public DrRssItem createItem()
	     {
	        return new DrRssItem();
	     }
	     
	     public class DrRssItem
	     {
	         private String _name = "";
	         private String _title = "";
	         private String _link = "";
	         private String _description = "";
	         private String _category = "";
	         private String _pubDate = "";
	         
	         
	         DrRssItem()
	         {
	         }
	         
	         DrRssItem(String name,String title,String link,String description,String category,String pubdate)
	         {
	             _name = name;
	             _title = title;
	             _link = link;
	             _description = description;
	             _category = category;
	             _pubDate = pubdate;
	         }
	         
	         public String getName()
	         {
	             return _name;
	         }
	         
	         public String getTitle()
	         {
	             return _title;
	         }
	         public String getLink()
	         {
	             return _link;
	         }
	         public String getDescription()
	         {
	             return _description;
	         }
	         public String getCategory()
	         {
	             return _category;
	         }
	         public String getPubDate()
	         {
	             return _pubDate;
	         }
	         
	         
	         public void setName(String name)
	         {
	             _name = name;
	         }
	         
	         
	         public void setTitle(String title)
	         {
	             _title = title;
	         }
	         public void setLink(String link)
	         {
	             _link  = link;
	         }
	         public void setDescription(String description)
	         {
	             _description = description;
	         }
	         public void setCategory(String category)
	         {
	             _category = category;
	         }
	         public void setPubDate(String pubdate)
	         {
	             _pubDate = pubdate;
	         }
	         public String toString()
	         {
	             String ret = "D";
	             
	             ret += "|" + _name;
	             ret += "|" + _title;
	             ret += "|" + _link;
	             ret += "|" + _description;
	             ret += "|" + _category;
	             ret += "|" + _pubDate;
	             
	             return ret;
	         }
	     }
}

 

 

Highlighted
Developer
Posts: 17,019
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: creating rss reader Help

i won't wade through pages of your code to find an unspecified error.
please describe your problem clearly and post a small sample instead of your whole application.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter