random - start app on a different layout each time? -
i want app when executed start different layout, have code allows me choose layout start want random thanks.
mypager.setcurrentitem(0);
pd: excuse english, not speaking, used translator
you can use java's built-in pseudo random number generator random value in defined range. use choose random value setcurrentitem
. example:
random r = new random(); int randomvalue = r.nextint( 5 ); mypager.setcurrentitem( randomvalue );
the value pass nextint
method one more maximum integer want receive; example above return random value between 0 , 4 (excluding 5).
Comments
Post a Comment