The variable behaves strangely ... changes its value somewhere, although it should not. All sections of the code where the variable is used are furnished with breakpoints. Nothing helps, the brain is already boiling.
I want to set a breakpoint on the "change value" event of a variable. Is there an AS? Those. if the variable changes the value, the breakpoint is triggered.
upd: Watch I know. I still can not track. We need exactly the event to change the value.
upd2: Variable of int type, registered in Activity. In fact, it has two important states, before the ContextMenu is called, the variable is initiated. After selecting an action in ContextMenu, the variable is used.
Everything works fine until you turn the screen. Some miracles begin. I also initiate a variable (before calling ContextMenu), but after calling ContextMenu, its value is reset. Why and who does it, I can not understand.
Once again, before turning the screen upside down - everything is fine. At the time of the screen flip, all variables are carefully saved and restored when the Activity becomes active.
upd3.
Activity class ad:
int selectItemPosition = -1;
Before Context Menu I assign the value:
selectItemPosition = (int) ib.getTag();
where ib is an ImageButton. I assign the tag to it in the ListView custom adapter when I am drawing this ImageButton (I have it in every ListView item). It is the ImageButton that calls the context menu.
After selecting the desired action in the context menu, I use:
mainAdapter.setFavorite(selectItemPosition);
And just when used, selectItemPosition becomes -1. Although, before the context menu was called, everything was fine. selectItemPosition matched the position in the list that caused the menu.
Once again. Before turning the screen, everything works. But after turning this mess ...