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

2011-08-07 Thread androidmediadeveloper
also, once you change the bitmap, you need to call invalidate() so onDraw is called again On Aug 6, 4:41 pm, Zwiebel hunzwie...@gmail.com wrote: Thanks I will try it! On aug. 6, 20:04, Kostya Vasilyev kmans...@gmail.com wrote: You are calling TextView.setText(int)

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

2011-08-07 Thread Kostya Vasilyev
Nope. setImageURI / setImageDrawable / setImageResource in ImageView all call requestLayout() and invalidate(). 07.08.2011 19:28, androidmediadeveloper пишет: also, once you change the bitmap, you need to call invalidate() so onDraw is called again On Aug 6, 4:41 pm,

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

2011-08-07 Thread Zwiebel
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

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

2011-08-06 Thread Zwiebel
I tried it out and sadly n is 0 everytime, but I don't know why. On aug. 6, 17:23, Miguel Morales therevolti...@gmail.com wrote: Add some logging so that you can see what n is. Then find out why it's not generating a random number. On Sat, Aug 6, 2011 at 8:33 AM, Zwiebel

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

2011-08-06 Thread Nikolay Elenkov
On Sun, Aug 7, 2011 at 2:38 AM, Zwiebel hunzwie...@gmail.com wrote: I tried it out and sadly n is 0 everytime, but I don't know why. Reading the docs usually helps: public static double random() Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.

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

2011-08-06 Thread Zwiebel
Thanks, I could make it with your helps. But now I'm found a new problem. I try to modify my textview with .setText method, but I got this error: ERROR/AndroidRuntime(3745): android.content.res.Resources $NotFoundException: String resource ID #0x1 ERROR/AndroidRuntime(3745): at

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

2011-08-06 Thread Kostya Vasilyev
You are calling TextView.setText(int) counter_txt_foe.setText(counter_foe); which expects an R.string resource ID for the text. Do this instead: counter_txt_foe.setText(String.valueOf(counter_foe)); to call TextView.setText(CharSequence) -- Kostya 07.08.2011 0:01, Zwiebel пишет: Thanks,

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

2011-08-06 Thread Kostya Vasilyev
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 пишет:

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

2011-08-06 Thread Zwiebel
Thanks I made it only forget to delete from here. On aug. 6, 20: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,

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

2011-08-06 Thread Zwiebel
Thanks I will try it! On aug. 6, 20:04, Kostya Vasilyev kmans...@gmail.com wrote: You are calling TextView.setText(int) counter_txt_foe.setText(counter_foe); which expects an R.string resource ID for the text. Do this instead: counter_txt_foe.setText(String.valueOf(counter_foe)); to