Android

Fatal Exception: java.lang.IllegalArgumentException: bound must be positive

ThreadLocalRandom 클래스를 사용하여 난수를 발생하는 코드를 작성하였는데, 일부 사용자로 부터 오류가 발생하였다.

 

Fatal Exception: java.lang.IllegalArgumentException: bound must be positive
       at java.util.concurrent.ThreadLocalRandom.nextInt(ThreadLocalRandom.java:268)
       at c.c.d.t.a.a()
       at com.app.hi.ui.slideshow.SlideshowFragment$l.onClick()
       at android.view.View.performClick(View.java:6261)
       at android.widget.TextView.performClick(TextView.java:11159)
       at android.view.View$PerformClick.run(View.java:23748)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6776)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
int ranNum  = nonNumList.get( ThreadLocalRandom.current().nextInt( nonNumList.size()) );

ThreadLocalRandom를 제거 하고 Random 클래스 사용으로 변경하였다.

 

 

Leave a Reply

error: Content is protected !!