×

Discussion Board

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

    How to controll flow of multiple Rss Files

    Hii
    i developed RssFeed Application using LWUIT j2me(java) for 2 xml files,now i want to show those 2 xml files on LWUIT Tabs,that means,when my application runs,default tab will be displayed(on that tab my first Rss xml file Titles should be displayed),and when the user click on tab2 my second Rss xml titles should be displayed,i am able to display the same titles of one rss files on both the tabs,how to control my flow to achieve my task?

    Here my Code:
    public class XMLMidlet extends MIDlet implements ActionListener {

    public XMLMidlet() {
    Display.init(this);
    news = new Vector();
    m_backCommand = new Command("Back");

    cmdExit = new Command("EXIT");
    cmdDetails = new Command("Details");
    }

    public void startApp() {
    //RssFeed URL's
    String urls[] = {"http://topnews-23.rss",
    "http://topstory-12.rss"};

    for(int i=0;i<urls.length;i++){
    ParseThread myThread = new ParseThread(this,urls[i]);
    //this will start the second thread
    myThread.getXMLFeed(urls[i]);
    }
    }

    //method called by the parsing thread

    public void addNews(News newsItem,String url) {
    try{
    news.addElement(newsItem);
    form1 = new Form();

    myNewsList = new List(newsVector);
    newsList =new List(newsVector);
    myNewsList.setRenderer(new NewsListCellRenderer());
    newsList.setRenderer(new NewsListCellRenderer());

    tabs=new Tabs(Component.TOP);

    tabs.addTab("TopNews", myNewsList);

    tabs.addTab("Topstory",newsList);

    form1.addComponent(tabs);
    form1.show();
    }

    catch(Exception e){
    e.printStackTrace();
    }
    }

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

    Re: How to controll flow of multiple Rss Files

    You can instantiate Form, Tabs and List in startApp() method as below
    private List myNewsList[];
    private int i=0;
    public void startApp() {
    form1 = new Form();
    tabs=new Tabs(Component.TOP);
    myNewsList= new List[2];

    //RssFeed URL's
    String urls[] = {"http://topnews-23.rss",
    "http://topstory-12.rss"};

    for(;i<urls.length;i++){
    ParseThread myThread = new ParseThread(this,urls[i]);
    //this will start the second thread
    myThread.getXMLFeed(urls[i]);
    }
    form1.addComponent(tabs);
    form1.show();
    }
    And the addNews() method call should look like below:
    public void addNews(News newsItem,String url) {
    try{
    news.addElement(newsItem);
    myNewsList[i] = new List(newsVector);
    myNewsList[i].setRenderer(new NewsListCellRenderer());

    if(i==0){
    tabs.addTab("TopNews", myNewsList[i]);

    } else{
    tabs.addTab("Topstory", myNewsList[i]);
    }
    }
    catch(Exception e){
    e.printStackTrace();
    }
    }

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

    Re: How to controll flow of multiple Rss Files

    here the answer:

    we should move below code

    myNewsList = new List(newsVector);
    newsList =new List(newsVector);
    myNewsList.setRenderer(new NewsListCellRenderer());
    newsList.setRenderer(new NewsListCellRenderer());
    tabs=new Tabs(Component.TOP);
    form1 = new Form();
    tabs=new Tabs(Component.TOP);
    tabs.addTab("TopNews", myNewsList);
    tabs.addTab("Topstory",newsList);

    from addNews method to constructor XMLMidlet.
    addNews method should use url parameter to differ for which list the newsItem is directed.
    Last edited by pavanragi; 2012-08-17 at 13:09.

Similar Threads

  1. uploading multiple files
    By rituoberoi in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2010-03-31, 11:06
  2. multiple optional add-on sis files
    By proberts in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 2
    Last Post: 2009-05-05, 01:12
  3. Replies: 3
    Last Post: 2008-11-28, 09:35
  4. Linking multiple UIs or Application Flow
    By doyouwant2cds in forum Symbian User Interface
    Replies: 11
    Last Post: 2008-10-29, 07:27
  5. Help please! want to controll multiple mobiles through cable.
    By Eman_Mughal in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-05-23, 15:20

Posting Permissions

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