I need to go into UnityPlayerActivity, and do something, then open a new Activity and pass the result of the operation, and close the current UnityPlayerActivity.
call method in UnityPlayerActivity:
public void onVideoRecorded(String videoPath) {
Intent intent = new Intent();
intent.setClassName(this, "com.example.my.activity.VideoActivity");
intent.putExtra("MP4_PATH", videoPath);
startActivity(intent);
finish();
}
to prevent the current process from being suspended by kill when exiting, the kill () method of UnityPlayer is rewritten:
class MyUnityPlayer extends UnityPlayer {
public MyUnityPlayer(Context context) {
super(context);
}
@Override
protected void kill() {
}
}
and change the type of mUnityPlayer to MyUnityPlayer. But it still doesn"t work. After entering the VideoActivity interface, the interface will get stuck, and then the interface will collapse after a few seconds.
Why does it crash to call finish () to close the UnityPlayerActivity interface immediately after opening an Activity?