android - Call a value from an OnClick method -



android - Call a value from an OnClick method -

i'm working on eclipse (android) , want phone call outside variable in onclick method. how can that? thought utilize homecoming onclick void method. here code

backgrounde2.setonclicklistener(new view.onclicklistener(){ public void onclick(view view){ int randominte = random2.nextint(deck.length()); int drawableide = deck.getresourceid(randominte, -1); backgrounde2.setbackgroundresource(drawableide); } });

i'm trying phone call variable randominte. how can if closed? have phone call other 4 variables in different setonclicklistener.

you can utilize global variable declared outside function.

public class mainactivity extends activity { int fnsetflag= 0; backgrounde2.setonclicklistener(new view.onclicklistener(){ public void onclick(view view){ fnsetflag= 1; } }); }

android eclipse

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -