Pressing the back button calls onDestory() method, is there any way not to do so, I mean ignoring the onDestory() method from being called

huangapple go评论54阅读模式
英文:

Pressing the back button calls onDestory() method, is there any way not to do so, I mean ignoring the onDestory() method from being called

问题

我有一个需求,在用户按下返回按钮时,不应调用onDestory()方法。有没有办法做到这一点?

英文:

I have a requirement where, whenever the user press the back button it shouldn't do call to onDestory() method. Is there any way to do so?

答案1

得分: 1

Sure, here's the translation:

是否有任何方法不这样做

你可以使用这个

@Override
public void onBackPressed() {
    moveTaskToBack(true);
}

如果需要的话,可以添加你自己的功能。

英文:

> is there any way not to do so

You can use this

 @Override
    public void onBackPressed() {
            moveTaskToBack(true);
    }

add your own functionalities , if you require

huangapple
  • 本文由 发表于 2020年9月17日 14:21:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/63932325.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定