Monday, 15 April 2013

multithreading - Method returns false in method call, but actually returns true to the callee in Android app -



multithreading - Method returns false in method call, but actually returns true to the callee in Android app -

so know should post code, code complex , don't think it'll help.

this method:

public boolean placeplayer(player player, int startingx, int startingy) { if(checknotonboard(startingx, startingy)) homecoming false; player.setstartingposition(startingx, startingy); placestartingtile(startingx, startingy); homecoming true; }

calls checknotonboard(), is:

private boolean checknotonboard(int positionx, int positiony) { if(_board.length < 1) homecoming true; if(positionx < 0 || positiony < 0) homecoming true; if((positionx < _board.length) && (positiony < _board[0].length)) homecoming true; homecoming false; }

i set debugging breakpoint @ if(checknotonboard(startingx, startingy)), stepped through method, went lastly line in method (return false), when returned placeplayer, however, homecoming true, , placeplayer moved homecoming false line. theory have _board beingness reset, far can tell, there no other thread running section of code. android app, , debugging on htc 1 m8 device , nexus 7 using android studio.

the debugger hits lastly line of method when homecoming executed. doesn't mean lastly statement executed. may happening java engine pops homecoming address off stack @ lastly line.

android multithreading android-studio htc

No comments:

Post a Comment