×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jul 2012
    Location
    India
    Posts
    103

    How to work with multiple rss files in j2me(java)

    Hi
    i am developing Rss Feed Reader App in j2me(java) for 2 xml files,but my for loop is having a problem,xml file is giving null,when i run my application ,control is not going to this method in my loop getXMLFeed(url1); ,instead of that it is completing for loop.can any one help?is my looping is correct?

    check my source code:
    urls = new String[2];
    urls[0] = "http://www.teluguone.com/news/tonefeeds/topnews/topnews-20.rss";
    urls[1] = "http://www.teluguone.com/news/tonefeeds/topstory/topstory-25.rss";
    for (int i = 0; i < urls.length; i++)
    {
    myThread = new ParseThread(this);
    myThread.getXMLFeed(url1);
    myDysplay.setCurrent(mform);
    }

    public void getXMLFeed(final String url) {
    Thread t = new Thread() {
    public void run() {
    myConnection = (HttpConnection) Connector.open(url);
    InputStream stream = myConnection.openInputStream();
    ParseXMLFeed(stream);}

  2. #2
    Nokia Developer Expert
    Join Date
    May 2012
    Posts
    224

    Re: How to work with multiple rss files in j2me(java)

    for (int i = 0; i < urls.length; i++)
    {
    myThread = new ParseThread(this);
    myThread.getXMLFeed(url1);
    myDysplay.setCurrent(mform);
    }
    modify above loop to following way
    myThread = new ParseThread(this); // or initialize this object somewhere in the startApp method
    for (int i = 0; i < urls.length; i++)
    {
    myThread.getXMLFeed(urls[i]);
    myDysplay.setCurrent(mform);
    }

  3. #3
    Registered User
    Join Date
    Jul 2012
    Location
    India
    Posts
    103

    Re: How to work with multiple rss files in j2me(java)

    Hii,I have change my code to below,but when i run my application,initially,the loop is executed completely and the form is displayed on device,with no data,and it is promting "Allow application to use for network for sending and receiving data? with yes or no buttons,when i press yes,the result of two rss feed xml files titles are mixed and displayed on device.my requirement is to read initially first rss file after that to read second rss file,in a loop
    myThread = new ParseThread(this); // or initialize this object somewhere in the startApp method,i think,with in the loop ,i am not able to open the stream?
    for (int i = 0; i < urls.length; i++)
    {
    myThread.getXMLFeed(urls[i]);
    myDysplay.setCurrent(mform);
    }





    Quote Originally Posted by bandarap View Post
    modify above loop to following way
    Last edited by pavanragi; 2012-08-01 at 11:30.

Similar Threads

  1. how to play multiple audio files in j2me
    By A.Saleh in forum Audio
    Replies: 2
    Last Post: 2010-06-08, 22:48
  2. Compressing multiple files or a folder with multiple files
    By dhineshkumar.s in forum Symbian C++
    Replies: 3
    Last Post: 2008-11-28, 09:35
  3. multiple flush() not work for j2me httpconnection?
    By tiansun in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2006-08-15, 18:59
  4. Nokia JAVA library work with J2ME ?
    By mmscpeg in forum General Messaging
    Replies: 1
    Last Post: 2002-10-09, 12:11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •