@kat===
the error is probably what kf has pointed out: since one year the frameLayout used by P5 has an id generated randomly, so to get it you have to use another way; as for me i use:
fl = (FrameLayout)act.getWindow().getDecorView().getRootView();