Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
arunbiet
Posts: 376
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Displaying contents in the MainScreen after parsing XML

I have an App where i am displaying contents in the screen from an XML.Now my requiremnt is that when onClicking a field it should parse another XML and repaint the same screen with new contents instead of pushing to another Screen.How to achive this?Kindly help

Please use plain text.
Developer
simon_hain
Posts: 15,873
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Displaying contents in the MainScreen after parsing XML

the same way you loaded the parsed data from the first xml.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
arunbiet
Posts: 376
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Re: Displaying contents in the MainScreen after parsing XML

Ya that is fine,but how to invalidate the screen,i mean the view should load in the same Screen instead of pushing to another screen.I tried

Manager manager= getMainManager();
manager.deleteAll(); 

in the constructor and than calling the same constructor with new xml,but nothing happens

 

Please use plain text.
Developer
arunbiet
Posts: 376
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Re: Displaying contents in the MainScreen after parsing XML

UiApplication.getUiApplication()
							.invokeLater(
									new Runnable() {
										public void run() {
											new MyMainScreen(link);
											//UiApplication.getUiApplication().pushScreen(new DescriptionScreen(link));
											//processXml(link);
										
											
										}
									});

 Calling this in my OnNavigation of LabelField and my contructor looks like dis

 

public MyMainScreen(String id) {
		super(VERTICAL_SCROLL);
		// int directions =
		// net.rim.device.api.system.Display.ORIENTATION_PORTRAIT;
		// net.rim.device.api.ui.Ui.getUiEngineInstance().setAcceptableDirections(directions);
		Manager manager= getMainManager();
		manager.deleteAll();
		processXml(id);
}

 

Please use plain text.
Developer
simon_hain
Posts: 15,873
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Displaying contents in the MainScreen after parsing XML

don't process xml on the event thread
http://supportforums.blackberry.com/t5/Java-Development/What-is-the-Event-Thread/ta-p/446865

check the xml sample for some ideas.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
arunbiet
Posts: 376
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Re: Displaying contents in the MainScreen after parsing XML

Ok but what about reloading the screen with new contents,do i have to use deleteAll() on my manager?

Please use plain text.
Developer
simon_hain
Posts: 15,873
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Displaying contents in the MainScreen after parsing XML

if you use setText on a textfield or something similar it is automatically invalidated.
basically it depends on your implementation.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
arunbiet
Posts: 376
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Re: Displaying contents in the MainScreen after parsing XML

No sir,actually i have a Screen where i am adding images text in Vertical and Horizontal managers and adding those managers into the screen.So i want that i need to delete all those managers and fields and also variable values as i am using static variables at multiple places

Please use plain text.
Developer
simon_hain
Posts: 15,873
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Displaying contents in the MainScreen after parsing XML

if you cannot re-use the components (by setting new images/text) you have to delete and re-add them, yes.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
arunbiet
Posts: 376
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

Re: Displaying contents in the MainScreen after parsing XML

So will it be sufficient if i do 

 

Manager manager= getMainManager();
		manager.deleteAll();

 in the constructor before parsing the new xml and adding the contents to the screen

Please use plain text.