How to use share intent?

How to use share intent?
0.0 0


I want to share some information from cocos game to any social services. I programmed this :
In cocos :
`void shareScreen()
jmethodID mShareScreenID = getMethodID(“ShareScreen”, “()V”);

    if (mShareScreenID)
        env->CallStaticVoidMethod(classOfCocos2dxActivity, mShareScreenID);

In Eclipse :
public static void ShareScreen () { Intent share = new Intent(Intent.ACTION_SEND); share.setType("text/plain"); share.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); share.putExtra(Intent.EXTRA_TEXT, "I'm being sent!!"); Cocos2dxActivity.mContext.startActivity(Intent.createChooser(share, "Share Text")); }

But, I whatever get error :

07-04 15:20:26.999: E/AndroidRuntime(14396): android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

Who can help me?