Я получаю исключение IllegalArgumentException при запуске следующего метода:
public int randomize(ArrayList<Integer> list){
Random rdm = new Random();
int size = list.size();
int chosen = rdm.nextInt(size);
Integer card = list.get(chosen);
list.remove(chosen);
return card;
}
Вот StackTrace:
11-22 16:52:16.890: E/AndroidRuntime(24979): FATAL EXCEPTION: main
11-22 16:52:16.890: E/AndroidRuntime(24979): java.lang.RuntimeException: Unable to start activity ComponentInfo{edu.marshall.meadows182.match/edu.marshall.meadows182.match.Match}: java.lang.IllegalArgumentException
11-22 16:52:16.890: E/AndroidRuntime(24979): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1821)
11-22 16:52:16.890: E/AndroidRuntime(24979): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1842)
11-22 16:52:16.890: E/AndroidRuntime(24979): at android.app.ActivityThread.access$1500(ActivityThread.java:132)
11-22 16:52:16.890: E/AndroidRuntime(24979): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
11-22 16:52:16.890: E/AndroidRuntime(24979): at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 16:52:16.890: E/AndroidRuntime(24979): at android.os.Looper.loop(Looper.java:143)
11-22 16:52:16.890: E/AndroidRuntime(24979): at android.app.ActivityThread.main(ActivityThread.java:4263)
11-22 16:52:16.890: E/AndroidRuntime(24979): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 16:52:16.890: E/AndroidRuntime(24979): at java.lang.reflect.Method.invoke(Method.java:507)
11-22 16:52:16.890: E/AndroidRuntime(24979): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-22 16:52:16.890: E/AndroidRuntime(24979): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-22 16:52:16.890: E/AndroidRuntime(24979): at dalvik.system.NativeStart.main(Native Method)
11-22 16:52:16.890: E/AndroidRuntime(24979): Caused by: java.lang.IllegalArgumentException
11-22 16:52:16.890: E/AndroidRuntime(24979): at java.util.Random.nextInt(Random.java:186)
11-22 16:52:16.890: E/AndroidRuntime(24979): at edu.marshall.meadows182.match.Match.randomize(Match.java:200)
11-22 16:52:16.890: E/AndroidRuntime(24979): at edu.marshall.meadows182.match.Match.initArrays(Match.java:108)
11-22 16:52:16.890: E/AndroidRuntime(24979): at edu.marshall.meadows182.match.Match.onCreate(Match.java:218)
11-22 16:52:16.890: E/AndroidRuntime(24979): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
11-22 16:52:16.890: E/AndroidRuntime(24979): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1785)
11-22 16:52:16.890: E/AndroidRuntime(24979): ... 11 more
ArrayLists, через которые я прохожу, содержат элементы (или они проходят через метод, который должен поместить их туда). Кто-нибудь знает, почему это так?