Rome Feeder - arrays & NPE
in
Contributed Library Questions
•
5 months ago
Hi! So I'm really new to Processing, and I've run smack into a wall that I can't find my way around. I'm using rome feeder to read an rss-feed, and I want to use the data from that rss-feed to create an array. However, I can't seem to get the variables from the array I make.
Here is my code:
- //romefeeder
- import com.wyldco.romefeeder.*;
- import com.sun.syndication.feed.synd.*;
- Feeder feeder; // the feeder
- SyndEntry entry; // a feed entry
- String content;
- FeederClass[]feedercontent = new FeederClass[10];
- void setup(){
- size(displayWidth, displayHeight, P3D);
- background(255);
- //create the feeder
- feeder = new Feeder(this);
- //turn on output to the console (useful for debugging)
- feeder.verbose = true;
- //set sort by published date
- //default is unsorted (i.e. as ordered in the feed)
- feeder.sortByPublishedDate();
- //load the feed
- feeder.load("http://monstercirkus.wordpress.com/feed/");
- }
- void draw(){
- background(255);
- while (feeder.hasNext()) {
- for (int i = 0; i < feedercontent.length ; i ++) {
- entry = feeder.next();
- content = entry.getTitle();
- feedercontent[i] = new FeederClass (content);
- println(feedercontent[i].s); // This works
- }
- }
- println(feedercontent[2].s); // This gets and NullPointerException-error.
- }
- // Feeder class
- class FeederClass {
- String s;
- FeederClass(String sval){
- this.s = sval;
- }
- }
1