Hi
I've created LWUIT tabs ,when the user clicks on any tab ,i want to read an Rss File and i want to display titles with images.
Here i am able to load lists related to specific tab individually whenever user clicks on any tab,But the problem comes when the user initially clicks on first tab ,then the titles related to that tab are gets loading,In the middle if the end user clicks on second tab then the titles from tab 1 are getting mix with titles from tab2 and are displayed on tab2..
Here my code:
In the Constructor:
Code:cinemanews = new Vector(); gossipnews=new Vector(); cinemaNewsList = new List(cinemanews); cinemaNewsList.setScrollVisible(false); cinemaNewsList.setRenderer(new NewsListCellRenderer()); gossipNewsList = new List(gossipnews); gossipNewsList.setScrollVisible(false); gossipNewsList.setRenderer(new NewsListCellRenderer()); Button b1=new Button("CinemaNews"); Button b2=new Button("GossipNews"); tabs.addTab(b1, cinemaNewsList); tabs.addTab(b2,gossipNewsList ); b2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (cinemanewsList .size() == 0) { process("xyz.rss"); Condition = tabs.getTabTitle(1); } } }); b3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (gossipNewsList.size() == 0) { process("xyz.rss"); Condition = tabs.getTabTitle(2); } } }); form1.addComponent(BorderLayout.CENTER, tabs);
Here my Condition:
if (Condition.equals("CinemaNews")) {
cinemanews.addElement(news);
form1.show();
}
if (Condition.equals("GossipNews")) {
gossipnews.addElement(news);
form1.show();
}
Can any one pls.. help me ?Is this Correct way to identify LWUIT Tabs Click Event?

Reply With Quote

