Sunday, August 7, 2011

[android-developers] Re: I can't show random images in the ImageView

Thanks for all, I could make it now!

Thanks for fast helps.

On aug. 6, 22:23, Kostya Vasilyev <kmans...@gmail.com> wrote:
> Oh, and here is another one:
>
> nextInt(3) can be one of: 0, 1, 2.
>
> nextInt(3) +1 then becomes one of: 1, 2, 3.
>
> This:
>
> imageArr[rndInt]
>
> expects values 0, 1, 2
>
> So, take out the "+1", to avoid getting an index-out-of-bounds exception.
>
> -- Kostya
>
> 07.08.2011 0:01, Zwiebel пишет:
>
> >            Random rand = new Random();
> >            int rndInt = rand.nextInt(3) + 1;
>
> --
> Kostya Vasilyev

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment