This time I found a workaround for it and it works great. but only for ndk demos.
in a subclass of ActivityGroup onCreate, write the following code.
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LocalActivityManager lam = getLocalActivityManager(); Intent intent = new Intent(); intent.setClass(this, TeapotNativeActivity.class); Window window = lam.startActivity("xxx", intent); // reflect call "willYouTakeTheSurface" NativeActivity callback = JavaCalls.callMethod(window.getDecorView(), "willYouTakeTheSurface"); if (callback != null) { window.takeSurface(null); getWindow().takeSurface(callback); getWindow().takeInputQueue(callback); } setContentView(window.getDecorView()); }
Haitao
source share