Sorry I got the mistake. On Wed, Jul 31, 2019 at 12:08 PM ashish singh <1998ashishsi...@gmail.com> wrote:
> edit to my last question. > backtrack(currentWay ,idx){ > if(idx>=22){ > system.out.println("ending"); > return; > }else{ > system.out.println(idx); > } > displayfixvariant(idx); > } > > displayfixvariant(idx){ > onclick "V" it will call; > backtrack(currentWay,idx+1); > } > > when backtrack is called for the first time it prints "idx" 1 and waits > for the key to press > when I am clicking v it is going to the last call of backtrack and > printing 22.It does not print 2 or 3 or any other idx. > I am not sure why it is happening > > On Wed, Jul 31, 2019 at 10:50 AM ashish singh <1998ashishsi...@gmail.com> > wrote: > >> I have to use key listener to fix some problems. >> >> MainApplication.getMap().mapView.requestFocus(); >> MainApplication.getMap().mapView.addKeyListener(new KeyListener(){ >> @Override >> public void keyTyped(KeyEvent e) { >> // TODO Auto-generated method stub >> } >> @Override >> public void keyPressed(KeyEvent e) { >> downloadCounter = 0; >> if (abort) { >> removeKeyListenerAndTemporaryLayer(this); >> return; >> } >> if (typedKeyUpperCase == 'V' || typedKeyUpperCase == '8') { >> removeKeyListenerAndTemporaryLayer(this); >> shorterRoutes = false; >> System.out.println("backtracking start"); >> backtrack(currentWay,idx+1); >> } >> @Override >> public void keyReleased(KeyEvent e) { >> // TODO Auto-generated method stub >> } >> }); >> >> in this piece of code after pressing 'V' it is not going inside the >> function backtrack().it is printing "backtracking start" but not going >> inside the function backtrack() I put some debug statement inside the >> backtrack() to check function is getting called or not and it is not >> getting called. >> >