我知道有吨的同样的问题,但仍OnActivityResult不会被调用。
I know there are tons of the same questions, but still OnActivityResult is not being called.
这是我的code
活动答:
Intent i = new Intent();
Bundle b = new Bundle();
b.putString(ActivityB.LINK, ad.getLink());
i.putExtras(b);
i.setClass(this, ActivityB.class);
startActivityForResult(i, 0);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
/*handling of result...*/
super.onActivityResult(requestCode, resultCode, data);
}
活动B:
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.ad_video);
Bundle b = this.getIntent().getExtras();
setResult(0);
link = b.getString(LINK);
videoView = (VideoView) findViewById(R.id.surface_view);
videoView.setVideoPath(_link);
videoView.requestFocus();
videoView.start();
videoView.setOnCompletionListener(new OnCompletionListener() {
public void onCompletion(MediaPlayer mp)
{
setResult(0);
ActivityB.this.finish();
}
});
}
无论我做什么, OnActivityResult
永远不会被调用。
基于其他问题
Whatever i do, OnActivityResult
is never called.
Based on other questions
我把的setResult与值> 0(0,99)
i put the setResult with values > 0 (0,99)
在Android清单没有launchMode(我也试图把 launchMode标准)
in android manifest there is no launchMode (I also tried to put launchMode to standard)
感谢您的帮助
好吧,我知道了, 主要的问题是,我从卡主机内称为activtiy。我从包含标签(扩展TabActivity一)活动名为它和它的工作原理。
Ok i got it, The main issue was that i called the activtiy from within the tab host. I called it from the Activity that contains the tabs (the one that extends TabActivity) and it works.
所以,简单地说,即使我用每个标签作为一项活动,维基,一个应该叫startActivityForResult是扩展TabActivity的主要活动。
So in brief, even though i'm using each tab as an activity, the one that should call the startActivityForResult is the main activity that extends TabActivity.
感谢大家的帮助,