Hello All,
I am trying to write some test code to receive RSS feeds. I am using the
ROME api's. But I am getting a exception when executing the following line
of code
  SyndFeed feed = new SyndFeedInput().build(reader);
I googled this exception and found the following. I dont know if thats
helpful or not. Please advice me on my next steps.
"Ok, I figured it out after traversing through the Rome code.
ClassLoader isn't supported by Android's DalvikVM. Is there an
implementation of this project that doesn't use ClassLoader?"
*Exception Stack*
Thread [<3> main] (Suspended (exception ExceptionInInitializerError))
 SyndFeedInput.build(Reader) line: 123
 MainActivity.onCreate(Bundle) line: 42
 Instrumentation.callActivityOnCreate(Activity, Bundle) line: 1123
 ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord) line:
2231
 ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord) line:
2284
 ActivityThread.access$1800(ActivityThread, ActivityThread$ActivityRecord)
line: 112
 ActivityThread$H.handleMessage(Message) line: 1692
 ActivityThread$H(Handler).dispatchMessage(Message) line: 99
 Looper.loop() line: 123
 ActivityThread.main(String[]) line: 3948
 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean)
line: not available [native method]
 Method.invoke(Object, Object...) line: 521
 ZygoteInit$MethodAndArgsCaller.run() line: 782
 ZygoteInit.main(String[]) line: 540
 NativeStart.main(String[]) line: not available [native method]


*Code*

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;

import android.app.Activity;
import android.os.Bundle;
import com.sun.syndication.*;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;

public class MainActivity extends Activity
{
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState)
  {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  URL url;
  try
  {
  url = new URL("http://viralpatel.net/blogs/feed";);
  }
  catch (MalformedURLException e1)
  {
  // TODO Auto-generated catch block
  e1.printStackTrace();
  return ;
  }
  XmlReader reader = null;

  try
  {
  reader = new XmlReader(url);
  SyndFeed feed = new SyndFeedInput().build(reader);
  System.out.println("Feed Title: "+ feed.getAuthor());
  for (Iterator i = feed.getEntries().iterator(); i.hasNext();)
  {
  SyndEntry entry = (SyndEntry) i.next();
  System.out.println(entry.getTitle());
  }
  }
  catch (IllegalArgumentException e)
  {
  e.printStackTrace();
  }
  catch (FeedException e)
  {
  e.printStackTrace() ;
  }
  catch (IOException e)
  {
  // TODO Auto-generated catch block
  e.printStackTrace();
  }
  /*finally
  {
  if (reader != null)
  try
  {
  reader.close();
  } catch (IOException e)
  {
  // TODO Auto-generated catch block
  e.printStackTrace();
  }
  } */
  }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to