3

I'm trying to start and activity from a FREFunction to use facebooks's SSO on my flex application.

I did in my FREFunction:

    @Override
    public FREObject call(FREContext context, FREObject[] args) {
         Intent myIntent = new Intent(context.getActivity(), FacebookSSO.class);
         context.getActivity().startActivity(myIntent);
         return null;
    }

I get with logcat:

I/ActivityManager( 1322): Starting activity: 
Intent{ cmp=air.testapp/com.test.android.ane.activity.FacebookSSO } from pid...

But my log calls in the onCreate method of are FacebookSSO.java are not displayed:

 @Override
 public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     //setContentView(R.layout.main);
     Log.d("FacebookSSO", "onCreate BEGIN.");
     Log.d("FacebookSSO", "onCreate END.");
 }

I tried creating myIntent in different ways, like using setClass. What am I doing wrong?

4

2 回答 2

1

你解决了这个问题吗?

您是否尝试过将类添加到应用程序描述符中的清单添加中?

<android>
    <manifestAdditions><![CDATA[
        <manifest android:installLocation="auto">
            <uses-permission android:name="android.permission.INTERNET"/>
            <application>
                <activity android:name="com.test.android.ane.activity.FacebookSSO"></activity>
            </application>
        </manifest>
    ]]></manifestAdditions>
</android>
于 2012-08-17T02:55:55.080 回答
0

您正在使用的Intent 构造函数需要一个 Context 作为其参数(请记住Activity 也是一个Context 。)

因为构造函数需要一个 Context 并且您从一个上下文开始,所以应该不需要调用getActivity(). 也是ContextstartActivity()的一种方法,因此您也不需要第二行中的 。但是我不知道这是否会导致您看到的错误。getActivity()

以这种方式尝试您的代码:

Intent myIntent = new Intent(context, FacebookSSO.class);
context.startActivity(myIntent);
于 2012-05-22T21:10:21.593 回答