Hi All,



I am working on an android mobile application,

I have a screen where i submit some data, if data is invalid i navigate app to error screen, 

On error screen i have action which takes me back to previous screen, now here if i use android back button, it takes me back to error screen, which is not true, here i have to clear the history.


Can anyone help me on maintaining the stacks.



Thanks,

DM.

HI Dhiraj,

On back button of error screen use previous screen as destination instead of selecting the specific screen as destination.

This will solve your problem.

Nikhil Gaur wrote:

HI Dhiraj,

On back button of error screen use previous screen as destination instead of selecting the specific screen as destination.

This will solve your problem.

Hi Nikhil,

I have used the same thing,

What i meant is, when i come back to the original screen from error screen,

Then when i click back button, it takes me back to error screen, here to go error screen i need to submit the from on which i am...Hope scenario is a bit clear now.


Thanks,

DM 


Hi Dhiraj,

You can use JS which will listen to the back-key Event & you can call the same client action which takes to the previous screen.

document.addEventListener("backbutton", [Function Name], false);


I have used same approach, created a block fro backKeyHandle & which initiate an event. I used the block in all screen & there's a back button listener which is in common for both backIcon & this BackKey Listener.






assif_tiger wrote:

Hi Dhiraj,

You can use JS which will listen to the back-key Event & you can call the same client action which takes to the previous screen.

document.addEventListener("backbutton", [Function Name], false);


I have used same approach, created a block fro backKeyHandle & which initiate an event. I used the block in all screen & there's a back button listener which is in common for both backIcon & this BackKey Listener.







Hi Assif...can you please share a bit detailed solution.


Thanks :)

Refer to the sample attached.

The idea was referred from Harlin Setiadarma Plugin.

Use this Plugin:

https://www.outsystems.com/forge/component-overview/4760/android-back-button-key

Put the Web block in the layout web block of your application this way you don't have to make this check on all the pages you want, you can then from the layout trigger the "OnAndroidBackKey" event again and on your screen, you decide which screen you want to get back to.