onActivityResult sometimes not called when Sub-Activity finishes

人盡茶涼 提交于 2019-12-04 06:27:56
Bobs

Maybe you have some developer options like kill activity flag or limit background process.

Go to setting-> developer options unchecked Don't keep activities and Background process limit set to standard limit.

For extra information check https://stackoverflow.com/a/14195833/779408 and https://stackoverflow.com/a/11522468/779408

Eduardo Siemann

Problem is "correlationId" < 0 :

/** use this method to launch the sub-Activity, and provide a functor to handle the result - ok or cancel */
public void launchSubActivity(Class subActivityClass, ResultCallbackIF callback) {

  Intent i = new Intent(this, subActivityClass);
  Random rand = new Random();
  int correlationId = rand.nextInt();

/*
Values os correlationId:

1972479154

477929567

-1246508909 = NEGATIVE = INVALID! 

*/

  if (correlationId < 0)
      correlationId *= -1;

  _callbackMap.put(correlationId, callback);
  startSubActivity(i, correlationId);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!