Android 从kotlin调用java活动以获取结果时,未调用onActivityResult
我正在我的项目中使用Kotlin和Java。我正在为Kotlin的结果打开一个Java活动,但是从未调用用Kotlin编写的Android 从kotlin调用java活动以获取结果时,未调用onActivityResult,android,kotlin,startactivityforresult,Android,Kotlin,Startactivityforresult,我正在我的项目中使用Kotlin和Java。我正在为Kotlin的结果打开一个Java活动,但是从未调用用Kotlin编写的onActivityResult函数 代码(Kotlin): logcat 09-19 23:13:18.343 1552-1843/? I/ActivityManager: START u0 {cmp=com.raj.ifa.debug/com.raj.ifa.ui.viewAllNotesAndReminder.ViewAllNotesActivity (has ext
onActivityResult
函数
代码(Kotlin):
logcat
09-19 23:13:18.343 1552-1843/? I/ActivityManager: START u0 {cmp=com.raj.ifa.debug/com.raj.ifa.ui.viewAllNotesAndReminder.ViewAllNotesActivity (has extras)} from uid 10081 on display 0
09-19 23:13:18.383 28407-28407/com.raj.ifa.debug I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
09-19 23:13:18.607 28407-28412/com.raj.ifa.debug I/art: Do partial code cache collection, code=124KB, data=100KB
09-19 23:13:18.619 28407-28412/com.raj.ifa.debug I/art: After code cache collection, code=123KB, data=100KB
09-19 23:13:18.619 28407-28412/com.raj.ifa.debug I/art: Increasing code cache capacity to 512KB
09-19 23:13:18.792 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:18.823 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:18.858 1552-1572/? I/ActivityManager: Displayed com.raj.ifa.debug/com.raj.ifa.ui.viewAllNotesAndReminder.ViewAllNotesActivity: +500ms
09-19 23:13:18.863 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:18.880 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:18.925 28407-28407/com.raj.ifa.debug W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
09-19 23:13:18.950 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:18.953 28407-28428/com.raj.ifa.debug D/OpenGLRenderer: endAllActiveAnimators on 0x8e89d080 (RippleDrawable) with handle 0x8e85d6c0
09-19 23:13:19.240 1552-22693/? I/WindowManager: Destroying surface Surface(name=com.raj.ifa.debug/com.raj.ifa.ui.userDetails.UserDetailsActivity) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.destroyOrSaveSurface:2073 com.android.server.wm.WindowManagerService.tryStartExitingAnimation:3017 com.android.server.wm.WindowManagerService.relayoutWindow:2897 com.android.server.wm.Session.relayout:215 android.view.IWindowSession$Stub.onTransact:286 com.android.server.wm.Session.onTransact:136
09-19 23:13:21.707 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:21.767 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:21.800 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:21.831 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:21.834 28407-28428/com.raj.ifa.debug D/OpenGLRenderer: endAllActiveAnimators on 0x8ce94e80 (RippleDrawable) with handle 0x8e85d270
09-19 23:13:22.084 1552-14164/? I/WindowManager: Destroying surface Surface(name=com.raj.ifa.debug/com.raj.ifa.ui.viewAllNotesAndReminder.ViewAllNotesActivity) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.removeLocked:1449 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2478 com.android.server.wm.WindowManagerService.removeWindowLocked:2436 com.android.server.wm.WindowManagerService.removeWindowLocked:2305 com.android.server.wm.WindowManagerService.removeWindow:2300 com.android.server.wm.Session.remove:193
09-19 23:13:22.261 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
有人能告诉我我的上述代码有什么问题吗?日志中有什么?@CodyCaughlan我已经更新了问题是否有任何碎片涉及到了活动或是活动到活动?@buradd it is activity toactivity@Mahesh是的,我解决了。代码没有问题,构建有问题。我刷新了gradle,它成功了
@Override
public void onBackPressed() {
Intent result = new Intent();
result.putParcelableArrayListExtra(AppConstants.NOTES_LIST, mNotesList);
setResult(Activity.RESULT_OK, result);
this.finish();
}
09-19 23:13:18.343 1552-1843/? I/ActivityManager: START u0 {cmp=com.raj.ifa.debug/com.raj.ifa.ui.viewAllNotesAndReminder.ViewAllNotesActivity (has extras)} from uid 10081 on display 0
09-19 23:13:18.383 28407-28407/com.raj.ifa.debug I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
09-19 23:13:18.607 28407-28412/com.raj.ifa.debug I/art: Do partial code cache collection, code=124KB, data=100KB
09-19 23:13:18.619 28407-28412/com.raj.ifa.debug I/art: After code cache collection, code=123KB, data=100KB
09-19 23:13:18.619 28407-28412/com.raj.ifa.debug I/art: Increasing code cache capacity to 512KB
09-19 23:13:18.792 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:18.823 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:18.858 1552-1572/? I/ActivityManager: Displayed com.raj.ifa.debug/com.raj.ifa.ui.viewAllNotesAndReminder.ViewAllNotesActivity: +500ms
09-19 23:13:18.863 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:18.880 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:18.925 28407-28407/com.raj.ifa.debug W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
09-19 23:13:18.950 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:18.953 28407-28428/com.raj.ifa.debug D/OpenGLRenderer: endAllActiveAnimators on 0x8e89d080 (RippleDrawable) with handle 0x8e85d6c0
09-19 23:13:19.240 1552-22693/? I/WindowManager: Destroying surface Surface(name=com.raj.ifa.debug/com.raj.ifa.ui.userDetails.UserDetailsActivity) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.destroyOrSaveSurface:2073 com.android.server.wm.WindowManagerService.tryStartExitingAnimation:3017 com.android.server.wm.WindowManagerService.relayoutWindow:2897 com.android.server.wm.Session.relayout:215 android.view.IWindowSession$Stub.onTransact:286 com.android.server.wm.Session.onTransact:136
09-19 23:13:21.707 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:21.767 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:21.800 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:21.831 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)
09-19 23:13:21.834 28407-28428/com.raj.ifa.debug D/OpenGLRenderer: endAllActiveAnimators on 0x8ce94e80 (RippleDrawable) with handle 0x8e85d270
09-19 23:13:22.084 1552-14164/? I/WindowManager: Destroying surface Surface(name=com.raj.ifa.debug/com.raj.ifa.ui.viewAllNotesAndReminder.ViewAllNotesActivity) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.removeLocked:1449 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2478 com.android.server.wm.WindowManagerService.removeWindowLocked:2436 com.android.server.wm.WindowManagerService.removeWindowLocked:2305 com.android.server.wm.WindowManagerService.removeWindow:2300 com.android.server.wm.Session.remove:193
09-19 23:13:22.261 28407-28428/com.raj.ifa.debug D/EGL_emulation: eglMakeCurrent: 0xa89852a0: ver 2 0 (tinfo 0xa8983630)