Blackberry: consuming a restful web service - blackberry

public void consumeIt(){
HttpConnection con = null;
InputStream is = null;
try {
String url = "http://where.yahooapis.com/geocode?q=1600+Pennsylvania+Avenue,+Washington,+DC";
System.out.println("poo" + url);
con = (HttpConnection) Connector.open(url);
final int responseCode = con.getResponseCode();
if (responseCode != HttpConnection.HTTP_OK) {
System.out.println("response code:" + responseCode);
}
System.out.println("Works here");
is = con.openInputStream();
byte[] responseData = new byte[10000];
int length = 0;
StringBuffer rawResponse = new StringBuffer();
while (-1 != (length = is.read(responseData))) {
rawResponse.append(new String(responseData, 0, length));
}
final String result = rawResponse.toString();
System.out.println("result:" + result);
}
catch (final Exception ex) {
System.out.println("error:" + ex.getMessage());
}
finally {
try {
is.close();
is = null;
con.close();
con = null;
}
catch(Exception e){}
}
}
I found the code above that is supposed to grab the xml data returned by the api, however I can't seem to get it working. The system print out with "poo" shows up, but not the "Works here." I have no idea what's wrong. I'm running it in a 9700 simulator.
Why is it so complicated to connect to a web service!

Please read about BB transports and networking.
For quick fix use this url:
"http://where.yahooapis.com/geocode?q=1600+Pennsylvania+Avenue,+Washington,+DC;deviceside=true"
instead of yours.

I already answer this type of errors occurred because of Network extensions
just see this answer this and take changes in your code absolutely it will work
please check the following link and take directions
https://stackoverflow.com/a/8575601/914111
after importing two classes into your project just change your code as following way
public void consumeIt(){
HttpConnection con = null;
InputStream is = null;
try {
String url = "http://where.yahooapis.com/geocode?q=1600+Pennsylvania+Avenue,+Washington,+DC";
System.out.println("poo" + url);
HttpConnectionFactory factory = new HttpConnectionFactory(0);
con = factory.getHttpConnection(url);
final int responseCode = con.getResponseCode();
if (responseCode != HttpConnection.HTTP_OK) {
System.out.println("response code:" + responseCode);
}
System.out.println("Works here");
is = con.openInputStream();
byte[] responseData = new byte[10000];
int length = 0;
StringBuffer rawResponse = new StringBuffer();
while (-1 != (length = is.read(responseData))) {
rawResponse.append(new String(responseData, 0, length));
}
final String result = rawResponse.toString();
System.out.println("result:" + result);
}
catch (final Exception ex) {
System.out.println("error:" + ex.getMessage());
}
finally {
try {
is.close();
is = null;
con.close();
con = null;
}
catch(Exception e){}
}
}
i got output as on my console like
result:<?xml version="1.0" encoding="UTF-8"?> <ResultSet version="1.0"><Error>0</Error><ErrorMessage>No error</ErrorMessage><Locale>us_US</Locale><Quality>87</Quality><Found>1</Found><Result><quality>85</quality><latitude>38.898717</latitude><longitude>-77.035974</longitude><offsetlat>38.898590</offsetlat><offsetlon>-77.035971</offsetlon><radius>500</radius><name></name><line1>1600 Pennsylvania Ave NW</line1><line2>Washington, DC 20006</line2><line3></line3><line4>United States</line4><house>1600</house><street>Pennsylvania Ave NW</street><xstreet></xstreet><unittype></unittype><unit></unit><postal>20006</postal><neighborhood></neighborhood><city>Washington</city><county>District of Columbia</county><state>District of Columbia</state><country>United States</country><countrycode>US</countrycode><statecode>DC</statecode><countycode>DC</countycode><uzip>20006</uzip><hash>B42121631CCA2B89</hash><woeid>12765843</woeid><woetype>11</woetype></Result></ResultSet> <!-- gws14.maps.sg1.yahoo.com uncompressed/chunked Thu Dec 22 21:22:38 PST 2011 --> <!-- wws2.geotech.sg1.yahoo.com uncompressed/chunked Thu Dec 22 21:22:38 PST 2011 -->

You can try this.
public void consumeIt()
{
HttpConnection con = null;
InputStream is = null;
String desiredEncoding = "ISO-8859-1";
StringBuffer returnStringBuffer = new StringBuffer();
OutputStream os=null;
try
{
String url = "http://where.yahooapis.com/geocode?q=1600+Pennsylvania+Avenue,+Washington,+DC";
System.out.println("poo" + url);
HttpConnectionFactory factory = new HttpConnectionFactory(0);
con = factory.getHttpConnection(url);
final int responseCode = con.getResponseCode();
if (responseCode != HttpConnection.HTTP_OK)
{
System.out.println("response code:" + responseCode);
}
System.out.println("Works here");
is = con.openInputStream();
int ch;
String contenttype = httpConnection.getHeaderField("Content-Type");
if (contenttype != null)
{
contenttype = contenttype.toUpperCase();
if (contenttype.indexOf("UTF-8") != -1)
{
desiredEncoding = "UTF-8";
}
}
InputStreamReader isr = new InputStreamReader(inputStream,desiredEncoding);
while ((ch = isr.read()) != -1)
{
returnStringBuffer.append((char) ch);
}
result=returnStringBuffer.toString();
System.out.println("Result........"+result);
}
catch (final Exception ex)
{
System.out.println("error:" + ex.getMessage());
}
finally
{
try
{
is.close();
is = null;
con.close();
con = null;
}
}
}

Related

Images are loading on simulater but not on Blackberry device

I am using following code to download images from server
public Bitmap connectServerForImage(String url) {
HttpConnection httpConnection = null;
DataOutputStream httpDataOutput = null;
InputStream httpInput = null;
int rc;
Bitmap bitmp = null;
try {
httpConnection = (HttpConnection) Connector.open(url+ ConnectionType.getConnectionType());
rc = httpConnection.getResponseCode();
if (rc != HttpConnection.HTTP_OK) {
throw new IOException("HTTP response code: " + rc);
}
httpInput = httpConnection.openInputStream();
InputStream inp = httpInput;
byte[] b = IOUtilities.streamToBytes(inp);
EncodedImage hai = EncodedImage.createEncodedImage(b, 0, b.length);
return hai.getBitmap();
} catch (Exception ex) {
System.out.println("URL Bitmap Error........" + ex.getMessage());
} finally {
try {
if (httpInput != null)
httpInput.close();
if (httpDataOutput != null)
httpDataOutput.close();
if (httpConnection != null)
httpConnection.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return bitmp;
}
and ConnetionType class is as follows
public class ConnectionType {
public static String getConnectionType()
{
String connectionString = null;
if (DeviceInfo.isSimulator())
{
connectionString = "";
return connectionString;
}
else if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED)
{
connectionString = ";interface=wifi";
return connectionString;
}
else if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_DIRECT) == CoverageInfo.COVERAGE_DIRECT)
{
String carrierUid = getCarrierBIBSUid();
if (carrierUid == null)
{
connectionString = ";deviceside=true";
return connectionString;
}
else
{
connectionString=carrierUid;
return connectionString;
}
}
else if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS)
{
connectionString = ";deviceside=false";
return connectionString;
}
else
{
connectionString = ";deviceside=true";
return connectionString;
]
}
/**
* Looks through the phone's service book for a carrier provided BIBS
* network
*
* #return The UID used to connect to that network.
*/
private static String getCarrierBIBSUid()
{
ServiceRecord[] records = ServiceBook.getSB().getRecords();
int currentRecord;
for (currentRecord = 0; currentRecord < records.length; currentRecord++)
{
if (records[currentRecord].getCid().toLowerCase().equals("ippp"))
{
if (records[currentRecord].getName().toLowerCase().indexOf("bibs") >= 0)
{
//otherwise, use the UID to construct a valid carrier BIB-S
String carrierUid= records[currentRecord].getUid();
String extension = ";deviceside=false;connectionUID=" + carrierUid + ";ConnectionType=mds-public";
return extension;
}
}
}
for (currentRecord = 0; currentRecord < records.length; currentRecord++)
{
if(records[currentRecord].getCid().toLowerCase().equals("wptcp"))
{
String carrierUid= records[currentRecord].getUid();
String extension = ";ConnectionUID="+carrierUid;
return extension;
}
}
return null;
}
}
Images are displaying fine on simulater but when I run this on my device No image displayed .Please suggest where I am missing.
Thanks!!!

BlackBerry - Dialog.cancel() on the login page

I have a login page that accepts username & password. When the user clicks "Login" a loading screen "Signing in.." is shown with the background thread calling a doLogin() method that calls a web service and load the appropriate page.
The problem I am facing is to "Cancel" signing in from Dialog.cancel() after login has been clicked. It cancels the loading screen but the background thread is still processing and even after clicking "cancel", the new page is loaded. How can I cancel the background thread?
Thread backgroundWorker = new Thread(new Runnable() {
public void run() {
doLogin(uname, pwd);
}
});
Dialog busyDialog = new Dialog("Signing in...",
new String [] { "Cancel" },
new int [] { Dialog.CANCEL},
Dialog.CANCEL,
Bitmap.getPredefinedBitmap(Bitmap.HOURGLASS))
{
public void fieldChanged(Field field1, int context1)
{
//Something to stop the login and close the loading screen
}
};
busyDialog.setEscapeEnabled(false);
busyDialog.show();
backgroundWorker.start();
And the method which it is calling that pushes the new screen is doLogin():
private String doLogin(String user_id, String password)
{
SoapObject resultRequestSOAP = null;
HttpConnection httpConn = null;
HttpTransport httpt;
SoapPrimitive response = null;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("username", user_id);
request.addProperty("password", password);
System.out.println("The request is=======" + request.toString());
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
httpt = new HttpTransport(URL+C0NNECTION_EXTENSION);
httpt.debug = true;
try
{
httpt.call(SOAP_ACTION, envelope);
response = (SoapPrimitive) envelope.getResponse();
String result = response.toString();
resultRequestSOAP = (SoapObject) envelope.bodyIn;
String[] listResult = split(result, sep);
strResult = listResult[0].toString();
if(strResult.equals("credentialdenied"))
{
Dialog.alert("Invalid login details.");
}
else
{
strsessionFirstName = listResult[1].toString();
strsessionLastName = listResult[2].toString();
strsessionPictureUrl = MAINURL + listResult[3].substring(2);
strsessionStatusId = listResult[4].toString();
strsessionStatusMessage = listResult[5].toString();
strsessionLastUpdateTst = listResult[6].toString();
}
if(strResult.equals("credentialaccepted"))
{
if(checkBox1.getChecked() == true)
{
persistentHashtable.put("username", user_id);
persistentHashtable.put("password", password);
}
Bitmap bitmap = getLiveImage(strsessionPictureUrl, 140, 140);
nextScreen.getUsername(user_id);
nextScreen.getPassword(password);
nextScreen.setPictureUrl(bitmap);
nextScreen.setImage(strsessionPictureUrl);
nextScreen.setFirstName(strsessionFirstName, strsessionLastName, strsessionLastUpdateTst, strsessionStatusMessage);
UiApplication.getUiApplication().invokeLater( new Runnable()
{
public void run ()
{
UiApplication.getUiApplication().pushScreen(nextScreen);
}
} );
}
} catch (IOException e) {
System.out.println("The exception is IO==" + e.getMessage());
} catch (XmlPullParserException e) {
System.out.println("The exception xml parser example==="
+ e.getMessage());
}
System.out.println( resultRequestSOAP);
return response + "";
}
You might need to add a boolean member variable to your class, that you check at multiple steps, within your doLogin() method:
private boolean stopRequested = false;
private synchronized void requestStop() {
stopRequested = true;
}
private synchronized boolean isStopRequested() {
return stopRequested;
}
private String doLogin(String user_id, String password)
{
SoapObject resultRequestSOAP = null;
HttpConnection httpConn = null;
HttpTransport httpt;
SoapPrimitive response = null;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("username", user_id);
request.addProperty("password", password);
System.out.println("The request is=======" + request.toString());
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
httpt = new HttpTransport(URL+C0NNECTION_EXTENSION);
httpt.debug = true;
if (isStopRequested()) return null;
try
{
httpt.call(SOAP_ACTION, envelope);
response = (SoapPrimitive) envelope.getResponse();
String result = response.toString();
resultRequestSOAP = (SoapObject) envelope.bodyIn;
String[] listResult = split(result, sep);
strResult = listResult[0].toString();
if(strResult.equals("credentialdenied"))
{
Dialog.alert("Invalid login details.");
}
else
{
strsessionFirstName = listResult[1].toString();
strsessionLastName = listResult[2].toString();
strsessionPictureUrl = MAINURL + listResult[3].substring(2);
strsessionStatusId = listResult[4].toString();
strsessionStatusMessage = listResult[5].toString();
strsessionLastUpdateTst = listResult[6].toString();
}
if (isStopRequested()) return null;
if(strResult.equals("credentialaccepted"))
{
if(checkBox1.getChecked() == true)
{
persistentHashtable.put("username", user_id);
persistentHashtable.put("password", password);
}
Bitmap bitmap = getLiveImage(strsessionPictureUrl, 140, 140);
nextScreen.getUsername(user_id);
nextScreen.getPassword(password);
nextScreen.setPictureUrl(bitmap);
nextScreen.setImage(strsessionPictureUrl);
nextScreen.setFirstName(strsessionFirstName, strsessionLastName, strsessionLastUpdateTst, strsessionStatusMessage);
if (isStopRequested()) return null;
UiApplication.getUiApplication().invokeLater( new Runnable()
{
public void run ()
{
UiApplication.getUiApplication().pushScreen(nextScreen);
}
} );
}
} catch (IOException e) {
System.out.println("The exception is IO==" + e.getMessage());
} catch (XmlPullParserException e) {
System.out.println("The exception xml parser example==="
+ e.getMessage());
}
System.out.println( resultRequestSOAP);
return response + "";
}
Then, stop the thread like this:
Dialog busyDialog = new Dialog("Signing in...",
new String [] { "Cancel" },
new int [] { Dialog.CANCEL},
Dialog.CANCEL,
Bitmap.getPredefinedBitmap(Bitmap.HOURGLASS))
{
public void fieldChanged(Field field1, int context1)
{
requestStop();
}
};

How i can display images from URL in blackberry?

i have simple url of image, i want to display that image in Bitmap Field.
this is my class..But it will is not give any result.
public class UrlToImage
{
public static Bitmap _bmap;
UrlToImage(String url)
{
HttpConnection connection = null;
InputStream inputStream = null;
EncodedImage bitmap;
byte[] dataArray = null;
try
{
connection = (HttpConnection) Connector.open(url, Connector.READ, true);
inputStream = connection.openInputStream();
byte[] responseData = new byte[10000];
int length = 0;
StringBuffer rawResponse = new StringBuffer();
while (-1 != (length = inputStream.read(responseData)))
{
rawResponse.append(new String(responseData, 0, length));
}
int responseCode = connection.getResponseCode();
if (responseCode != HttpConnection.HTTP_OK)
{
throw new IOException("HTTP response code: "
+ responseCode);
}
final String result = rawResponse.toString();
dataArray = result.getBytes();
}
catch (final Exception ex)
{ }
finally
{
try
{
inputStream.close();
inputStream = null;
connection.close();
connection = null;
}
catch(Exception e){}
}
bitmap = EncodedImage.createEncodedImage(dataArray, 0,dataArray.length);
// this will scale your image acc. to your height and width of bitmapfield
int multH;
int multW;
int currHeight = bitmap.getHeight();
int currWidth = bitmap.getWidth();
multH= Fixed32.div(Fixed32.toFP(currHeight),Fixed32.toFP(480));//height
multW = Fixed32.div(Fixed32.toFP(currWidth),Fixed32.toFP(360));//width
bitmap = bitmap.scaleImage32(multW,multH);
_bmap=bitmap.getBitmap();
}
public Bitmap getbitmap()
{
return _bmap;
}
}
Thanx in advance.
Try this but here url extension is important.
if your mobile using wifi then ";interface=wifi" this is working otherwise it wont work so for url extensions plese verify following url
For url extensions Link
public static Bitmap connectServerForImage(String url)
{
HttpConnection httpConnection = null;
DataOutputStream httpDataOutput = null;
InputStream httpInput = null;
int rc;
Bitmap bitmp = null;
try
{
httpConnection = (HttpConnection) Connector.open(url+";interface=wifi");
rc = httpConnection.getResponseCode();
if (rc == HttpConnection.HTTP_OK)
{
httpInput = httpConnection.openInputStream();
InputStream inp = httpInput;
byte[] b = IOUtilities.streamToBytes(inp);
EncodedImage hai = EncodedImage.createEncodedImage(b, 0, b.length);
bitmp=hai.getBitmap();
}else{
throw new IOException("HTTP response code: " + rc);
}
}catch (Exception ex) {
System.out.println("URL Bitmap Error........" + ex.getMessage());
} finally
{
try
{
if (httpInput != null)
httpInput.close();
if (httpDataOutput != null)
httpDataOutput.close();
if (httpConnection != null)
httpConnection.close();
} catch (Exception e)
{
e.printStackTrace();
}
}
return bitmp;
}
I am getting solution of this Question..
See this url for All connection: BlackBerry simulator can connect to web service, but real device can't
public final class MyScreen extends MainScreen
{
String url="";
public MyScreen()
{
setTitle("MyTitle");
BitmapField pic = new BitmapField(connectServerForImage(url));
this.add(pic);
}
public static Bitmap connectServerForImage(String url)
{
HttpConnection httpConnection = null;
DataOutputStream httpDataOutput = null;
InputStream httpInput = null;
int rc;
Bitmap bitmp = null;
try
{
if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED)
{
httpConnection = (HttpConnection) Connector.open(url+ ";interface=wifi",Connector.READ_WRITE, true);
}
else
{
httpConnection = (HttpConnection) Connector.open(url+";deviceside=true", Connector.READ_WRITE, true);
}
rc = httpConnection.getResponseCode();
if (rc != HttpConnection.HTTP_OK) {
throw new IOException("HTTP response code: " + rc);
}
httpInput = httpConnection.openInputStream();
InputStream inp = httpInput;
byte[] b = IOUtilities.streamToBytes(inp);
EncodedImage hai = EncodedImage.createEncodedImage(b, 0, b.length);
return hai.getBitmap();
} catch (Exception ex) {
System.out.println("URL Bitmap Error........" + ex.getMessage());
} finally {
try {
if (httpInput != null)
httpInput.close();
if (httpDataOutput != null)
httpDataOutput.close();
if (httpConnection != null)
httpConnection.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return bitmp;
}
}

Download and show image on a BlackBerry

I have to develop a url which involves downloading image from url and show in blackberry stimulator..Can anyone help me in this regard???
This code 'll connect the given URL and returns Bitmap object
public static Bitmap connectServerForImage(String url) {
HttpConnection httpConnection = null;
DataOutputStream httpDataOutput = null;
InputStream httpInput = null;
int rc;
Bitmap bitmp = null;
try {
httpConnection = (HttpConnection) Connector.open(url);
rc = httpConnection.getResponseCode();
if (rc != HttpConnection.HTTP_OK) {
throw new IOException("HTTP response code: " + rc);
}
httpInput = httpConnection.openInputStream();
InputStream inp = httpInput;
byte[] b = IOUtilities.streamToBytes(inp);
EncodedImage hai = EncodedImage.createEncodedImage(b, 0, b.length);
return hai.getBitmap();
} catch (Exception ex) {
System.out.println("URL Bitmap Error........" + ex.getMessage());
} finally {
try {
if (httpInput != null)
httpInput.close();
if (httpDataOutput != null)
httpDataOutput.close();
if (httpConnection != null)
httpConnection.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return bitmp;
}
U can create a bimapfield and asign this bitmap as
BitmapField bmpFld1=new BitmapField(connectServerForImage(Url));
For base 64 string decoding
try {
mapaByte = Base64InputStream.decode(imagenB64);
Bitmap mapa64 = Bitmap.createBitmapFromBytes(mapaByte, 0, -1, 1);
mapa.setBitmap(mapa64);
}
catch (Exception e) {}

How to parse RSS Feed and display it as Links in Blackberry Application?

I wanted to parse the xml feed and display as links in my Blackberry application.
After googling it, i found out that i have to use SAX parser. I have not found any good example.
For example if i want to parse the news rss feed from bbc.co.uk. How to do it. How to extract images from rss feed.
Please Help, Advise, and Guide me.
SIA
Thanks
Lets say its twitter rss xml we are talking about:
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"
xmlns:georss="http://www.georss.org/georss">
<channel>
<title>Twitter / LPProjekt</title>
<link>http://twitter.com/LPProjekt</link>
<atom:link type="application/rss+xml"
href="http://twitter.com/statuses/user_timeline/27756405.rss" rel="self"/>
<description>Twitter updates from Linkin Park Projekt</description>
<language>en-us</language>
<ttl>40</ttl>
<item>
<title>LPProjekt: the instrumental from "what ive done"</title>
<description>LPProjekt: the instrumental from "</description>
<pubDate>Sun, 07 Feb 2010 23:34:26 +0000</pubDate>
<guid>http://twitter.com/LPProjekt/statuses/8784251683</guid>
<link>http://twitter.com/LPProjekt/statuses/8784251683</link>
</item>
..
</channel>
</rss>
First of all implement handler for your xml, to take < title > and < link > value from < item > only:
class RSSHandler extends DefaultHandler {
boolean isItem = false;
boolean isTitle = false;
boolean isLink = false;
String[] title = new String[] {};
String[] link = 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 = "";
}
}
}
Now, to use it, get InputStream from HttpConnection and put it all in SAXParser.parse:
static String[][] getURLFromRSS(String url) {
InputStream is = null;
HttpConnection connection = null;
RSSHandler rssHandler = new RSSHandler();
try {
connection = (HttpConnection) Connector.open(url);
is = connection.openInputStream();
try {
SAXParser parser = SAXParserFactory.newInstance()
.newSAXParser();
parser.parse(is, rssHandler);
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (is != null)
is.close();
if (connection != null)
connection.close();
} catch (IOException e) {
e.printStackTrace();
}
}
String[][] result = new String[2][];
result[0] = rssHandler.title;
result[1] = rssHandler.link;
return result;
}
Now use custom LabelField as a link field:
class LinkLabel extends LabelField
{
String mUrl = "";
public LinkLabel(String title, String url) {
super(title, FOCUSABLE);
mUrl = url;
}
protected boolean navigationClick(int status, int time) {
Browser.getDefaultSession().displayPage(mUrl);
return true;
}
}
Sample of use:
public Scr() {
String rssUrl = "http://twitter.com/statuses/user_timeline/27756405.rss";
String[][] urlData = getURLFromRSS(rssUrl);
for (int i = 0; i < urlData.length; i++) {
String title = urlData[0][i];
String url = urlData[1][i];
add(new LinkLabel(title, url));
}
}
alt text http://img215.imageshack.us/img215/7583/rssurl.jpg

Resources