问题描述
我的工作与Android 1.6为目标的项目。
I'm working on a project with android 1.6 as target.
所以,我不能用
@Override public void onBackPressed(){...}
我开始一个活动以
I'm starting an activity with
startActivityForResult(intent,requestcode)
和我wan't找回一些信息
And I wan't to get back some info with
@Override protected void onActivityResult (int requestCode, int resultCode, Intent data)
的问题是:
- '活动A'抛出'活动B
-'Activity A' throws 'Activity B'
-during'ActivityB'硬件后退按钮是pssed $ P $
-during 'ActivityB' the hardware back button is pressed
- '活动A的的onActivityResult叫,但我没有得到数据中的任何信息(数据== NULL)
-'Activity A's onActivityResult is called but I don't get any info in data (data==null)
我试图把一些额外的信息在活动B的
I'm trying to put some extra info at 'Activity B's
@Override protected void onPause(){...}
我还呼吁的setResult(RESULT_OK,I);这个的onPause,但我总是RESULT_CANCELED和数据== NULL在活动A的的onActivityResult
I also call setResult(RESULT_OK,i); into this onPause but I always get RESULT_CANCELED and data==null at 'Activity A's onActivityResult
推荐答案
pssed你可以使用:
Instead of onBackPressed you can use:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK)) {
//set result and finish()
} else {
return super.onKeyDown(keyCode, event);
}
}
这篇关于Android 1.6的,返回键和的onActivityResult的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!