1

In my application I have a requirement to navigate from one screen to another without popping up the active screen so that if a user clicks the back button while navigating he should be able to view the previous screens where he came from. I implemented this by pushing screens one by one in the UI stack but while doing so I saw that there is a considerable consumption of the memory. Can anyone tell me how can I minimize the memory used. In my app I saw that the memory is not released that much.

Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
Jayakrishnan Salim
  • 977
  • 1
  • 10
  • 24

2 Answers2

1

you can achieve it by this way .... it will work as you want.


ButtonField yourButton = new ButtonField("your Buton"){
         protected boolean navigationClick(int status, int time) {
               UiApplication.getUiApplication().
               popScreen(UiApplication.getUiApplication().getActiveScreen());
            return true;
            }
    };
BBdev
  • 4,898
  • 2
  • 31
  • 45
  • This is not what I actually need. I have some serious issues with memory in my application. I called runtime.freememory() when each screen is being loaded and I found that each screen is consuming 4-5 MB. When it reaches around 290 MB (initially it was 360 MB) then the app is getting hang. But still I have 290 MB of memory. What could be the reason for this hang? Is that something related to threads? – Jayakrishnan Salim Jul 08 '11 at 06:28
  • This actually the code for which you can get the `back button` working it take you to the `previous active screen` ... But i haven't know about the memory issue... if i required anything like pressing back button should go to the previous screen or any thing like that i use this code..... – BBdev Jul 08 '11 at 08:27
0

The memory issue was not due to pushing so much screens to the display stack. I had some serious issues in my code due to which the resources were not releasing ending up in OutOfMemory exception.

I had corrected them and due to that my application is working well now. As far as I know now, there should not be any issues in pushing so many screens. It should work well.

Jayakrishnan Salim
  • 977
  • 1
  • 10
  • 24