how to handle device back button on sencha touch application

后端 未结 2 1188
天命终不由人
天命终不由人 2020-12-24 03:53

In Sencha touch if I use navigation view i can get back button. This is pretty fine.

But what if user hit device backbutton? it is direct exiting the applicaiton.

2条回答
  •  温柔的废话
    2020-12-24 04:35

    You can handle hardware back button like this:

    if (Ext.os.is('Android')) {
        document.addEventListener("backbutton", Ext.bind(onBackKeyDown, this), false);
    
        function onBackKeyDown(eve) {
    
            eve.preventDefault();
    
            //do something
            alert('back button pressed');
    
        }
    }
    

提交回复
热议问题