java - Programatic call to a method vs. a user initiated call via the UI - how to handle both when the application must know the difference? -


i have 2 spinners, spinner , spinner b. when user changes a, b gets updated full new set of data. implemented callback b use setonitemselectedlistener can modify objects in class whenever b changed user.

b.setonitemselectedlistener(new onitemselectedlistener() {     public void onitemselected(adapterview<?> parent, view view, int position, long id) {         mcomponentcolor.setselection(position);         mcompcolorasbuilt[mcomponent.getcomponentselection()] = position;         setcolor();          } }); 

the problem i've ran don't want these objects change unless user 1 changed spinner. because automatically populate b based on a's selection, b's callback invoked when users changes a.

any thoughts how deal situation?

i ended solving using similar method flags method mentioned above, did inside object adjusted when onclicklistener methods invoked.

basically remembering last state of spinner is, check before adjust objects within it. if state same, nothing gets changed. fortunately object adjustments done class, made relatively easy handle. i'm not overly happy it, think better using flags within activity class.

thanks contributed.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -