Android Random -


string rank[] = {"tclub1.png", "tclub2.png", "tclub3.png", "tclub4.png",   "tclub5.png", "tclub6.png", "tclub7.png", "tclub8.png", "tclub9.png",   "tclub10.png", "tclub11.png", "tclub12.png", "tclub13.png"};  random randint = new random(); int b = randint.nextint(rank.length); string d = ("tclub" + b + ".png"); log.v(log_tag, "in value:=" + d); 

above code. array giving me 1 random index between(0 12)..after m appending make image name. eg(tclub1.png) image name gives me string fromat. how can assign thhis image randomly??

if want load image imageview, can this:

string imgname = "tclub1"; // image want load int id = getresources().getidentifier(imgname, "drawable", getpackagename());   imageview.setimageresource(id);  

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -