onActivityResult是从来没有所谓的TabActivity [英] onActivityResult is never called in TabActivity

查看:89
本文介绍了onActivityResult是从来没有所谓的TabActivity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有吨的同样的问题,但仍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

  1. 我把的setResult与值> 0(0,99)

  1. 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.

感谢大家的帮助,

这篇关于onActivityResult是从来没有所谓的TabActivity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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