Search code examples
java-melwuit

lwuit text area


I developed an RSS Application for two XML files and displayed it on two LWUIT Tabs. The problem is with my LWUIT TextArea, whenever I click on my ListForm (it contains titles from the RssFile), I need to display description information from the RSS File. First time I am able to display the description related to the title clicked in ListForm. If I click the ListForm the next time onwards I am able to display the same description again and again in the textarea..(Eventhough I am getting Related Description from RssFile)

Here is my Code:

        private void displayCompleteNewsScreen(News detailNews) {

        Label title = new Label(detailNews.getTitle()); 
        form2.setTitleComponent(title);
        String Description = detailNews.getDescription();
        System.out.println("Description" + Description);//Here i am able to get different Description values Related to myList Screen but in text area it is displaying First one always
        big = new TextArea();

        big.setEditable(false);
        big.setText(Description);

        form2.addComponent(pubDate);
        form2.addComponent(big);
        form2.show();
    }

Solution

  • As you are reusing form2 instance you should clear it in displayCompleteNewsScreen method. Call removeAll before calling setTitleComponent.

    And don't forget to set form2 Commands again in displayCompleteNewsScreen.