Oh, right, okay... Well the line where you're doing the assigning makes no sense, as we don't know what size is... In general this is a topic better suited a Java forum, not the Android list, since there's nothing specific to the SDK in here...
kris On Fri, Mar 23, 2012 at 2:23 PM, Kristoffer <[email protected]> wrote: > Hello. > > This is the basic code of a memory game, > > cards = new int [COL_COUNT] [ROW_COUNT]; > > with my first code then the problem was that one card always where at > the same place, and as you noticed with the "fix" then the code > does throw IllegalArgumentException > > On 23 mar, 19:08, a1 <[email protected]> wrote: >> > Thanks for pointing that out for me. >> >> This is wrong of course: r.nextInt(0) will throw IllegalArgumentException. >> >> First of all try to remove try/catch block - you are suppressing all errors >> that way and none of the function that you are calling inside it should >> throw. My guess is that you are getting ArrayIndexOutOfBounds due to >> incorrect indexing here: >> >> cards[i%COL_COUNT][i/COL_COUNT]=t%(size/2); >> >> but since I don't know how cards is allocated and what you are trying to >> achieve that's just a guess. >> >> -- >> Bart > > -- > 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 -- 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

