We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hiya
I recently installed 0255 so I can play with cardboard which is working and fun... Thanks!
but while I found I can use surface.getActivity()... I can't find a fix for the onCreate(bundle) thing.
// keep screen on
import android.os.Bundle;
import android.view.WindowManager;
void onCreate(Bundle bundle) {
super.onCreate(bundle);
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
also needed for Ketai bluetooth
Answers
Try this:
this.getActivity().getWindow().add.....
Kf
@hjarvie===
can you explain exactly what you want??? your code seems correct and has to work... adding "this" does not matter here.
Sorry.. I assumed it was a known thing.
When I installed android 0255 I started getting errors from the code segment above.
I got "The method onCreate(Bundle) is undefined for the type PApplet" from the super.onCreate line and another error from the getActivity line.
The getActivity one was resolved by using "surface." in the same way kfrajer suggested using "this" after reading https://github.com/processing/processing-android/issues/227
I got the same error from onCreate compiling the Ketai bluetooth example.
I must have done something dumb.... I'll reinstall and check
@hjarvie===
i have tested your code and it runs without any error... yet i am not using 0255 but some version before and so i cannot tell you why you get error for getActivity() and onCreate() (your link is not good (github))
Thanks.... I fixed the link. I also reinstalled 0255 with no change, but I guess it could still be something in my setup as it took a couple of goes to get the ide to recognise the sdk. Hopefully someone with 0255 can try it.