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

Web and WebWorks Development

Reply
Highlighted
Developer
Posts: 21
Registered: ‎02-03-2009
My Device: Not Specified
Accepted Solution

How to detect if page loads from startup or from back ?

My Widget has 3 pages, which navigate in this order:
page1 -> page2 -> page3

On load of page1, I make a web service call to retreive a json object, which I store into a file on the device.
Then page2 and page3 read the file to display their data.

There is 2 different way of accessing page1:
 1) Widget startup
 2) Press back in page2
 
For 1), I want to retreive the json from the web service
For 2), I want to retreive the json from the file (no web service call)

How can I detect if the page1 loads from 1) or 2) ?

Developer
Posts: 21
Registered: ‎02-03-2009
My Device: Not Specified

Re: How to detect if page loads from startup or from back ?

I found a solution.

Using the blackberry.system.event.onHardwareKey event, I can trap the back key in page2, set the location.href to page1 + a querystring value indicating I'm comming back from page2.