AutoGo icon indicating copy to clipboard operation
AutoGo copied to clipboard

"your target activity haven't been started." when activity not started from AutoGo

Open registernet opened this issue 9 years ago • 2 comments

Hello @TellH , would you please check the below issue? Thanks very much. When the activity is not started from AutoGo.from(xxx).gotoXXX().xxx.go();, there might be problems in the target activity's AutoGo.assign(this), as the autoAssigner may not be initialized yet.

  1. If the project is huge, it would take a lot of time to check every startActivity entry, any one entry left without using AutoGo....go() might get into trouble.
  2. If the activity is started outside, like from a push event, then there is no way to initialize the autoAssigner, it definitely will cause problems. So, it would be better to init the autoAssigner in the AutoGo.assign(this) method rather than AutoGo.gotoXXX(), one way of doing this is in the method AutoGo.getAssigner(Activity):

AutoAssigner autoAssigner = autoAssignerMap.get(className); if(autoAssigner == null) { autoAssigner = (AutoAssigner) Class.forName(className + "_AutoAssigner").newInstance(); autoAssignerMap.put(className, autoAssigner); }

the second way of doing this is for users who are using the AutoGo lib: when you call AutoGo.assign(this); call AutoGo.from(this).gotoSelfActivityName(); before it.

registernet avatar Aug 31 '16 10:08 registernet

Very sorry about that. I am busy with handling the stuff in university resently. I will check it out as soon as possible. It would be wonderful if you arise a PR. Thanks for your kindness and advice!

TellH avatar Aug 31 '16 10:08 TellH

Well, I want to, but it's a little awkward that I don't know how.

registernet avatar Sep 09 '16 12:09 registernet