-5

I am completely new at this so if you want to direct me to something informative and educational i completely understand.

I have a file full of images and i want them to display in an app one after the other when they are clicked.

any help would be greatly appreciated

  • 3
    Your question is lacking needed context -- what type of program is this? What have you tried? What isn't working? Can you show us your present code? Are you sure that you mean Java and not JavaScript -- they are completely different you know? Please tell us the important details, and soon as the question risks being closed as too broad or unclear without these details. – Hovercraft Full Of Eels Aug 09 '14 at 18:57
  • To expand in what Hovercraft said, it is customary here not to include greetins or thanks in the question, as all the content should be relevant to it. So, I would have deleted everything but one line. That is all the information you are giving us. – Davidmh Aug 09 '14 at 19:02
  • do u want the images to be randomly displayed??? – Harsh Aug 09 '14 at 19:05

2 Answers2

0

Make a list of your image path and use a method that increment the index of the list, that return a different image. You can also use a radomizer of this index

0

If you are using html js and css:

jsfiddle http://jsfiddle.net/harshdand/dec2mpbv/

html:

<img src="http://picture-gallery.dnspk.com/albums/userpics/10001/normal_1124750273-15.jpg" id="images"/>

js

  1. make an array of images u want

    var currentImageIndex = 0;
    
    var images=[
        'http://picture-gallery.dnspk.com/albums/userpics/10001/normal_1124750273-15.jpg',
        'http://images7.alphacoders.com/408/thumbbig-408758.jpg',
        'http://images6.alphacoders.com/410/thumbbig-410020.jpg',
        'http://picture-gallery.dnspk.com/albums/userpics/10001/normal_1127034390-11.jpg'
    ];
    

    document.getElementById('images').setAttribute('src',images[0]);

    document.getElementById('images').onclick = function(){
        if(currentImageIndex<images.length-1)
            currentImageIndex++;
        else
            currentImageIndex = 0;
         document.getElementById('images').setAttribute('src',images[currentImageIndex]);
    }
    
Harsh
  • 1,072
  • 1
  • 10
  • 16