onBack pressed()未执行 [英] onBackPressed() not being executed

查看:122
本文介绍了onBack pressed()未执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实施onBack pressed()方法,在我的活动。这是我的应用程序至关重要的是,我有这个功能。但是,控制永远不会进入该功能。它进入的onPause()来代替,当我preSS后退按钮。

但问题是我不能有相同的逻辑中的onPause(),因为当我打电话另一个活动,目前活动调用的onPause(),我不希望它执行应该在onBack $ P $什么pssed()。

请帮忙。

 公共无效onBack presed(){   Log.d(TAG,里面onBack pressed());
       如果(状态== preVIEW){       }
}


解决方案

 公共无效onBack presed(){

您输入一个人的,它应该是onBack pre *的 SS 的ED *()

I'm implementing the onBackPressed() method in my activity. It's crucial to my app that I have this functionality. But, the control never enters this function. It enters onPause() instead, when I press the back button.

But the problem is I can't have the same logic in onPause() because when I call another activity, the current activity calls onPause() and I don't want it to execute what should be in onBackPressed().

Please help.

public void onBackPresed(){

   Log.d(TAG,"inside onBackPressed()");
       if(STATE == PREVIEW){

       } 
}

解决方案

public void onBackPresed(){

you typed one 's', it should be onBackPre*ss*ed()

这篇关于onBack pressed()未执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆