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

问题描述

限时删除!!

到目前为止,我成功地使用了startActivity功能,现在,我需要用startActivityResult,我有一个问题。

So far, I used the startActivity function with success and now that I need to use the startActivityResult, I have a problem.

在使用此功能时,我期望能够推出的活动是正常启动,但它似乎是onActivityResult函数没有被调用。

When using this function, the activity I expect to be launched is launched correctly but it seems like the onActivityResult function is never called.

下面是我的code在FriendPicker活动,劳克的MoodPicker活动:

Here is my code in the FriendPicker activity, to lauch the MoodPicker activity:

Intent intent = new Intent(FriendPicker.this, MoodPicker.class);
startActivityForResult(intent, 2);

和这里是我的code。在MoodPicker活动:

And here is my code in the MoodPicker activity:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent)
{
    super.onActivityResult(requestCode, resultCode, intent);

    Log.i("in OnActivityResult", "Activity Result");

    switch (requestCode)
    {
        case 2:
            Log.i("in OnActivityResult", "Activity Resut 2");

            break;
    }
}

和没有在我的日志文件被写入(当然,我检查了我的日志文件被正常工作,仔细检查了文本视图输出)。

and nothing in my logfile is written (I of course, checked that my log file was working properly and double check with a text view output).

有什么我忘了在manifest文件中声明?

Is there something I forgot to declare in the Manifest file?

在此先感谢。

推荐答案

你添加的<$c$c>setResult()在你的MoodPicker类调用?

Did you add the setResult() call in your MoodPicker class ?

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

1403页,肝出来的..

09-06 23:25