protected Object navigation ( final Context context , final Postcard postcard , final int requestCode , final NavigationCallback callback ) { try { LogisticsCenter . completion ( postcard ) ; } catch ( NoRouteFoundException ex ) { logger . warning ( Consts . TAG , ex . getMessage ( ) ) ; if ( debuggable ( ) ) { // Show friendly tips for user. runInMainThread ( new Runnable ( ) { @ Override public void run ( ) { Toast . makeText ( mContext , "There's no route matched!\n" + " Path = [" + postcard . getPath ( ) + "]\n" + " Group = [" + postcard . getGroup ( ) + "]" , Toast . LENGTH_LONG ) . show ( ) ; } } ) ; } if ( null != callback ) { callback . onLost ( postcard ) ; } else { // No callback for this invoke, then we use the global degrade service. DegradeService degradeService = ARouter . getInstance ( ) . navigation ( DegradeService . class ) ; if ( null != degradeService ) { degradeService . onLost ( context , postcard ) ; } } return null ; } if ( null != callback ) { callback . onFound ( postcard ) ; } if ( ! postcard . isGreenChannel ( ) ) { // It must be run in async thread, maybe interceptor cost too mush time made ANR. interceptorService . doInterceptions ( postcard , new InterceptorCallback ( ) { /** * Continue process * * @param postcard route meta */ @ Override public void onContinue ( Postcard postcard ) { _navigation ( context , postcard , requestCode , callback ) ; } /** * Interrupt process, pipeline will be destory when this method called. * * @param exception Reson of interrupt. */ @ Override public void onInterrupt ( Throwable exception ) { if ( null != callback ) { callback . onInterrupt ( postcard ) ; } logger . info ( Consts . TAG , "Navigation failed, termination by interceptor : " + exception . getMessage ( ) ) ; } } ) ; } else { return _navigation ( context , postcard , requestCode , callback ) ; } return null ; }
Use router navigation .