Android Question Card flip (flip between 2 images)

stari

Active Member
Licensed User
Longtime User
I try example from @cimperia and get error:

** Activity (main) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 47 (B4XDeck)
java.lang.ArrayIndexOutOfBoundsException: length=54; index=54
at com.simplysoftware.flipcards.b4xdeck._initialize(b4xdeck.java:121)
at com.simplysoftware.flipcards.main._activity_create(main.java:409)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at com.simplysoftware.flipcards.main.afterFirstLayout(main.java:107)
at com.simplysoftware.flipcards.main.access$000(main.java:19)
at com.simplysoftware.flipcards.main$WaitForLayout.run(main.java:85)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6518)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
** Activity (main) Resume **

I can't find a solution. Does anyone know?
 

LucaMs

Expert
Licensed User
Longtime User
I try example from @cimperia and get error:
Next time you should post a link to the example (we don't know what/where is it).

Error occurred on line: 47 (B4XDeck)
java.lang.ArrayIndexOutOfBoundsException: length=54; index=54
Don't forget that the base index of arrays is zero, not one. It is likely that you have a deck of 54 cards (French, with jokers) and the array should therefore be Dim arrDeck (53), ie from index zero to index 53, total 54 cards.
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
Sorry;


@cimperia

 
Upvote 0

stari

Active Member
Licensed User
Longtime User
@LucaMs thank you. I will tray.

1608101627471.png


@brianwiz12 here:
 
Upvote 0

stari

Active Member
Licensed User
Longtime User
Next time you should post a link to the example (we don't know what/where is it).


Don't forget that the base index of arrays is zero, not one. It is likely that you have a deck of 54 cards (French, with jokers) and the array should therefore be Dim arrDeck (53), ie from index zero to index 53, total 54 cards.
Thks, but still the same error.
Huh, i can't find solution
 
Upvote 0
Top