This should work fine. Any errors? There might be something wrong in the loadImage method.
On Nov 11, 12:16 pm, Alok Upadhyay <[email protected]> wrote: > Hi, > i have a nest button on clicking which a new image should be > displayed.But not happening so.... > i have taken an integer array as: > private int imageCounter = 0; > private int index_count = 0; > private ImageView imageView; > private int[] imageArray = {R.drawable.image_w_lbl_0, > R.drawable.image_w_lbl_1,}; > > //in oncreate i have done something like this: > public void onCreate(Bundle savedInstanceState) > { > setContentView(R.layout.frame0);//this one is the common > parent > layout for all imageviews > super.onCreate(savedInstanceState); > imageView = new ImageView(this); > > ImageButton next = (ImageButton) findViewById(R.id.next); > ImageButton back = (ImageButton) findViewById(R.id.back); > next.setOnClickListener(this); > back.setOnClickListener(this); > > //show the default image > this.loadImage(imageArray[0]); > > } > > in onclick something like this: > int imagePath = 0; > // TODO Auto-generated method stub > switch (v.getId()) > { > case R.id.next: > if(imageCounter < 25) > { > > imagePath = imageArray[index_count]; > } > index_count++; > imageCounter++; > break; > case R.id.back: > if(imageCounter > 0) > { > //imagePath = > } > > break; > > } > > this.loadImage(imagePath); > //now i have loadImage method to load image into imageview -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

