07-24-2012 02:33 AM - edited 07-24-2012 02:41 AM
I want to display a screen first after i need to read xml and write to screen and display again; how it do these things. That is first i need to display background image in the screen then loading sympol(reading xml that time) after reading the values and images assign to background image screen. please help me how to do these....
Thanks in advance
07-24-2012 03:43 AM
First Set the background image to vertical or horizontal manager so that it can be invalidated after reading xml.
After addding the fields to constructor,
call a function using timertask it may wait upto few seconds so that user able to view the screen and then read xml upto that show the loading image by using runnable, after that set the background manager using new image and xml values to corresponding fields then invalidate the screen.
07-24-2012 05:23 AM
Thanks to All,
xml values are coming from server side and i need to display in my current screen, if i navigate to any other pages, again coming to same screen then it show old values agian read xml values then it write to same screen.
07-24-2012 06:41 AM
use onExposed method of the screen.
07-24-2012 08:01 AM
onExposed does not help here, at least not as far as I can see. Remember that onExposed is called numerous times, like for example when a menu is displayed and then discarded.
From what I can see, the user must display a screen saying something like 'downloading', and then when the values come, must replace this with the actual data. When that screen is revisited, the user must display the current data, while attempting to get new data, then update the screen with new data.
The basic process is similar to that already described by gopi. The screen will be recreated each time it is invoked, and if there is already downloaded data, it will be added and this is what the user will see. The screen creation processing will start a download Thread, when the Thread completes it will save the downloaded data (for next time) and update the screen with the new data.
Can the original poster please explain which parts of this process are causing problems.
Note that there are very many similar Threads already on the forum, that discuss downloading and displaying XML data. The difference here is that the processing does not block while the data is being downloaded. Instead the user can view old data (if any).
07-24-2012 09:19 AM
Its depend on the implementation how u want to used onExposed (with some flag and variable we can restricted to execute only when the screen pop from the stack. I also suggest instead of rendering entire screen again just replace your component with respect to xml data.
07-24-2012 10:59 AM
"execute only when the screen pop from the stack"
Note that if you are looking to detect screen pop and push, you can use onUiEngineAttached().
"I also suggest instead of rendering entire screen again just replace your component with respect to xml data"
Be aware, that if you add, delete or replace a component, it will typically relayout the whole screen anyway.
07-24-2012 11:26 AM
Hi thanks to ALL for your valuable response, whatever pete_strange metioned in the above same thing iam looking.
While downloading values from server, same time i need to show old data after completed the downloaded data i need to display new values. For that same object i need to assign new values, after i can call invalidate method.
This way it will work know?
Thanks in advance
07-24-2012 12:42 PM
Mostly, but I'd like to clarify a few things. .
People have the impression that invalidate() updates the screen, so that it is needed to make sure things change. If you are writing a standard UI Program this is not the case. Most Fields will in fact cause a refresh themselves if you update them. Sp for example, if you call:
there is no need for you to do an invalidate - the text on the screen will be updated automatically.
In your case, once you have the downloaded values, you will do one of two things:
a) Update the Fields on the screen with new values - this is the option you have suggested.
b) Replace the Fields on the screen with updated Fields.
In fact,(b) will perform significantly faster than (a) provided you do the replace in one go. So this is what i would recommend that you do.
The easiest way to do this is to have a Manager (say a VerticalFieldManager) on the screen, that has all the XML values. Create a new VFM, add the updated XML Fields into that, then swap the old Manager for a the new one.
The one potentially downside of (b) is that the user, who is currently scrolling through the old data, will loose their position. In fact I think that is a good thing, because it makes it clear that there is new data to see.