×

Discussion Board

Results 1 to 1 of 1

Threaded View

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

    RssApplication and LWUIT TAB

    i developed Rss Application for an xml file,and i successfully excetuted and displayed it on lwuit form,now i want to show the same rss file on lwuit tab,i have developed below code,i am not able to run my application,i am stopping my execution at form1.show(),my form1 is not able to display,if i remove the statement form1.show();my Rss loop is exceuting,but not displaying?initially,i am able to display the same for 3 tabs,but i dontknow ,now i am not able to display even single tab also?
    here my code:

    private void ParseXMLFeed(InputStream input)
    throws IOException, XmlPullParserException {

    Reader dataReader = new InputStreamReader(input);
    KXmlParser myParser = null;
    try {
    myParser = new KXmlParser();
    } catch (Exception e) {
    e.printStackTrace();
    }
    myParser.setInput(dataReader);
    myParser.nextTag();
    myParser.require(XmlPullParser.START_TAG, null, "rss");\
    myParser.nextTag();
    myParser.require(XmlPullParser.START_TAG, null, "channel");
    myParser.nextTag();
    myParser.require(XmlPullParser.START_TAG, null, "title");

    while (myParser.getEventType() != XmlPullParser.END_DOCUMENT) {
    String name = myParser.getName();

    if (name.equals("channel")) {
    break;
    }

    if (name.equals("item")) {

    if (myParser.getEventType() != XmlPullParser.END_TAG) {
    myParser.nextTag();
    String title = myParser.nextText();
    myParser.nextTag();
    String link = myParser.nextText();
    myParser.nextTag();
    String pubDate = myParser.nextText();
    myParser.nextTag();
    News news = new News(title, link, pubDate);
    parentMidlet.addNews(news);
    }
    } else {

    myParser.skipSubTree();
    }

    myParser.nextTag();
    }

    input.close();
    }



    //method called by the parsing thread

    public void addNews(News newsItem) {

    {
    System.out.println("test"); news.addElement(newsItem);

    form1.show();
    System.out.println("test123");//here i am stopping when i executed my app
    }


    //this is the code i placed it in my constructor

    newsList = new List(news);
    newsList.setScrollVisible(false);

    newsList.setRenderer(new NewsListCellRenderer());

    tabs = new Tabs(Component.TOP);
    form1 = new Form();
    form1.setLayout(new BorderLayout());
    form1.setScrollable(false);

    tabs.addTab("Topstory", newsList);

    form1.addComponent(BorderLayout.CENTER,tabs);
    } catch (Exception e) {
    e.printStackTrace();

    }
    Last edited by pavanragi; 2012-08-23 at 06:02.

Similar Threads

  1. How to append LWUIT List screen to a LWUIT Form in j2me?
    By pavanragi in forum Mobile Java General
    Replies: 1
    Last Post: 2012-08-06, 07:01
  2. error with LWUIT com.sun.lwuit.impl.midp.CanvasImplementation
    By aymen.ka in forum Mobile Java General
    Replies: 2
    Last Post: 2011-10-27, 11:41
  3. Can anyone help me in lwuit
    By kumarv75 in forum Mobile Java General
    Replies: 4
    Last Post: 2010-06-02, 12:46
  4. LWUIT 1.3 on N73
    By frasene in forum Mobile Java General
    Replies: 1
    Last Post: 2010-01-30, 07:26

Posting Permissions

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