且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

onActivityResult前onResume()被称为()?

更新时间:2023-09-28 16:56:04

onResume之前onActivityResult的通话情况,其实(见的的文档)。你确定你真正开始你想与 startActivityForResult 的活动,你设置调用活动的结果为 RESULT_OK 的值返回到你的活动之前?尽量只把一个登录语句在 onActivityResult 登录该值,并确保被击中。此外,你在哪里设置的 isLoggedIn preference的价值?这似乎是你应该设置,为在你登录活动之前返回反正,但是这显然不会发生。

The call to onActivityResult happens before onResume, actually (see the docs). Are you sure you're actually starting the activity you wanted with startActivityForResult and that you're setting the result of the invoked activity to RESULT_OK before returning a value to your activity? Try just putting a Log statement in your onActivityResult to log that value and make sure that gets hit. Also, where are you setting the value of the isLoggedIn preference? It seems like you should be setting that to true in your login activity before it returns anyways, but that's clearly not happening.