I want to add a button in my App and touch it to show self in freeform window. what should I do? Can it be done?
my code is:
`public static void startFreeWindow() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Activity activity = Cocos2dxHelper.getActivity();
Intent intent = new Intent(activity, activity.getClass());
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT );
ActivityOptions activityOptions = ActivityOptions.makeBasic();
try {
Method method = ActivityOptions.class.getMethod("setLaunchWindowingMode", int.class);
method.invoke(activityOptions, 5);
}catch (Exception e){
Log.i("FreeForm", "getActivityOptions error = " + e);
}
activityOptions.setLaunchBounds(new Rect(0, 0, 500, 500));
Bundle bundle = activityOptions.toBundle();
activity.startActivity(intent, bundle);
}
}`
But Nothing happened. I made sure its executed the code(startActivity).