When you click on the button (btnNext) in the ImageView , the picture should change, in fact, the code is working, but there is a problem. When I click on this button, my activation is recreated and therefore the array starts working from the very beginning. Is there a solution to this problem?
Button btnNext = (Button) dialog.findViewById(R.id.btnNext); final int[] images = { R.drawable.p_reset, R.drawable.pic, }; btnNext.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub dialog.dismiss(); finish(); startActivity(getIntent()); ImageView imageView = (ImageView) findViewById(R.id.imageView); imageView.setImageResource(images[0]); } });