java - Toggle though pictures using value of Count by button press -
i have app have 3 different picture galleries. pictures displayed when button pressed, displays count on screen telling user number picture looking at. picture changes when button pressed , count goes up.
the problem have 3 different galleries, want next gallery of pics start straightaway after first one. if have 5 pics in gallery a, when count reaches 5 , when button pressed again, want count go 1 , onto gallery b.
any ideas on how can achieve this?
here code far:
public class picgalleries <onpause> extends activity { //count button textview txtcount; imageview image; button btncount; static int count=0; txtcount = (textview)findviewbyid(r.id.count); txtcount.settext("this app has been started " + count + " times."); image = (imageview) findviewbyid(r.id.imageview); btncount = (button)findviewbyid(r.id.click); count++; count = 1; image.setimageresource(r.drawable.image1gallerya); count = 2; image.setimageresource(r.drawable.image2gallerya); count = 3; image.setimageresource(r.drawable.image3gallerya); count = 4; image.setimageresource(r.drawable.image4gallerya); count = 5; image.setimageresource(r.drawable.image5gallerya); count = 1; image.setimageresource(r.drawable.image1galleryb); count = 2; image.setimageresource(r.drawable.image2galleryb); txtcount.settext(string.valueof(count));
put them hashmap , key of hashmap count , value resource id of corresponding picture based on count variable can relevant picture.
Comments
Post a Comment