Android Tutorial JumpingSmiley - GameView example III

Discussion in 'Tutorials & Examples' started by Erel, Feb 7, 2013.

Thread Status:
Not open for further replies.
  1. Erel

    Erel Administrator Staff Member Licensed User

    This is another example of GameView: GameView - Create 2D Android games - Part I

    This is a simple "jumping" game where the user controls the movement by tilting the device:

    [​IMG]

    There are two types of objects: Smiley - the main object and Brick which represents a single brick.

    When the smiley moves upwards the background moves downwards. Bricks that go out of the screen are removed. A new brick is added instead of each removed brick.

    Some of the bricks are moving and some of the bricks shrink when the smiley bounces on them.

    All the sizes are scaled based on the device screen size (using percentage units).

    Currently the game never ends. You can change it by modifying Smiley.Tick sub.

    I think that this example is simpler than the Asteroids example as there are less "moving parts".
     

    Attached Files:

    Last edited: Feb 9, 2016
  2. buras3

    buras3 Active Member Licensed User

    error

    hey erel

    I got this on running

    AndroidManifest.xml:15: error: No resource identifier found for attribute 'hardwareAccelerated' in package 'android'

    tank you
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    You should reference android.jar from platform level 11 or higher. Also note that GameView is only supported on Android 3+ (see the first tutorial for more information).
     
  4. Informatix

    Informatix Expert Licensed User

    This example runs well under Gingerbread if you lower the minSDKversion and remove the isHardwareAccelerated condition.
     
    Bill Kantz likes this.
  5. Informatix

    Informatix Expert Licensed User

    Just a word for guys who'd like to use the sensors in their game: some tablets don't have a gyroscope, others don't have an accelerometer (but it's rare because the accelerometer is used to detect the device rotation). The gyroscope is usually missing when the GPS is missing too (and that's not uncommon on tablets). To be short: if you have to choose a sensor for tilting, prefer the accelerometer to the gyroscope.
     
    Bill Kantz likes this.
  6. buras3

    buras3 Active Member Licensed User

    tank you erel
    now i get
    Copying libraries resources 0.00
    Signing package file (private key) 0.23
    ZipAlign file. 0.02
    Installing file to device. Error
    pkg: /data/local/tmp/JumpingSmiley.apk
    Failure [INSTALL_FAILED_OLDER_SDK]

    Restarting ADB Server may solve this problem.

    michael
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    The minimum version of this application is Android 3 (API level 11). You can do as Informatix wrote in post #4 to run it on older devices, without hardware acceleration.
     
  8. atreyuatnz

    atreyuatnz New Member Licensed User

    No tilt action?

    I am new to Java, I have had no problem running all the demos except this one, bouncing smiley, I have a Nextbook premium 8 tablet with Android ver: 4.0.3, the game loads & runs fine but there seems to be no tilt action happening?

    Other tilt games run fine, Ive followed all the posts in this thread to try to get it to work? Help?
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    Try to run this example: Orientation and accelerometer

    Is ORIENTATION supported on your device? Do the value change when you tilt the device?
     
  10. atreyuatnz

    atreyuatnz New Member Licensed User

    No tilt action

    O.k it says Orientation not supported, so what can I do?:BangHead:

    Even thou I am a total noob I understand that my Tablet only supports (ACCELEROMETER) So I followed your guide (http://www.basic4ppc.com/forum/basi...6647-orientation-accelerometer.html#post38780)
    & change it from this.

    'Class module
    Sub Class_Globals
    Private animator As SpriteAnimator
    Private sensor As PhoneSensors
    Private SIZE = 12%x As Float
    Private mbd As BitmapData
    Private JUMP_SPEED As Float = -4%y
    Private bricks As List
    Private gm As GameManager
    End Sub

    Public Sub Initialize (bd As BitmapData, vBricks As List, vGm As GameManager)
    mbd = bd
    gm = vGm
    mbd.DestRect.Initialize(50%x, 85%y, 50%x + SIZE, 90%y + SIZE)
    bricks = vBricks
    animator.Initialize
    Dim r As Rect
    animator.SetFrames(bd, Array As Rect(r), Array As Bitmap(LoadBitmap(File.DirAssets, "smiley.gif")))
    animator.width = SIZE
    animator.height = SIZE
    sensor.Initialize2(sensor.TYPE_ORIENTATION, 0)
    animator.vy = JUMP_SPEED
    End Sub

    Private Sub Sensor_SensorChanged (Values() As Float)
    animator.vx = -PerXToCurrent(Max(-30, Min(30, Values(2))) / 10)
    End Sub

    Public Sub Tick
    animator.vy = animator.vy + 0.2%y
    mbd.Rotate = mbd.Rotate + animator.vx / 1%x
    animator.Tick(mbd)
    If animator.vy > 0 Then 'check for collisions on the way bottom
    For Each brck As Brick In bricks
    If brck.bd.DestRect.Left < mbd.DestRect.CenterX AND brck.bd.DestRect.Right > mbd.DestRect.CenterX Then
    If mbd.DestRect.Bottom < brck.bd.DestRect.Top AND mbd.DestRect.Bottom + animator.vy + 0.2%y > brck.bd.DestRect.Top Then
    'adjust the speed so the smiley will touch the brick on the next tick.
    animator.vy = brck.bd.DestRect.Top - mbd.DestRect.Bottom - 0.2%y
    Else If mbd.DestRect.Bottom = brck.bd.DestRect.Top Then
    animator.vy = JUMP_SPEED
    gm.PlaySound(gm.BOUNCE_SOUND, 1)
    If brck.disappearing Then
    brck.Shrink
    End If
    Exit
    End If
    End If
    Next
    End If
    If animator.vy < 0 AND mbd.DestRect.Top < 40%y Then
    'scroll the background
    gm.ScrollDown(-animator.vy / 1.5)
    mbd.DestRect.Top = mbd.DestRect.Top - animator.vy / 2
    mbd.DestRect.Bottom = mbd.DestRect.Bottom - animator.vy / 2
    End If
    'instead of ending the game we bounce the smiley
    If mbd.DestRect.Bottom >= 100%y Then animator.vy = JUMP_SPEED
    End Sub

    Public Sub StartSensor
    sensor.StartListening("Sensor")
    End Sub

    Public Sub StopSensor
    sensor.StopListening
    End Sub



    To this



    'Class module
    Sub Class_Globals
    Private animator As SpriteAnimator
    Private Accelerometer As PhoneAccelerometer
    Private SIZE = 12%x As Float
    Private mbd As BitmapData
    Private JUMP_SPEED As Float = -4%y
    Private bricks As List
    Private gm As GameManager
    End Sub

    Public Sub Initialize (bd As BitmapData, vBricks As List, vGm As GameManager)
    mbd = bd
    gm = vGm
    mbd.DestRect.Initialize(50%x, 85%y, 50%x + SIZE, 90%y + SIZE)
    bricks = vBricks
    animator.Initialize
    Dim r As Rect
    animator.SetFrames(bd, Array As Rect(r), Array As Bitmap(LoadBitmap(File.DirAssets, "smiley.gif")))
    animator.width = SIZE
    animator.height = SIZE
    Accelerometer.Initialize2(Accelerometer.TYPE_ACCELEROMETER, 0)
    animator.vy = JUMP_SPEED
    End Sub

    Private Sub Accelerometer_AccelerometerChanged (Values() As Float)
    animator.vx = -PerXToCurrent(Max(-30, Min(30, Values(2))) / 10)
    End Sub

    Public Sub Tick
    animator.vy = animator.vy + 0.2%y
    mbd.Rotate = mbd.Rotate + animator.vx / 1%x
    animator.Tick(mbd)
    If animator.vy > 0 Then 'check for collisions on the way bottom
    For Each brck As Brick In bricks
    If brck.bd.DestRect.Left < mbd.DestRect.CenterX AND brck.bd.DestRect.Right > mbd.DestRect.CenterX Then
    If mbd.DestRect.Bottom < brck.bd.DestRect.Top AND mbd.DestRect.Bottom + animator.vy + 0.2%y > brck.bd.DestRect.Top Then
    'adjust the speed so the smiley will touch the brick on the next tick.
    animator.vy = brck.bd.DestRect.Top - mbd.DestRect.Bottom - 0.2%y
    Else If mbd.DestRect.Bottom = brck.bd.DestRect.Top Then
    animator.vy = JUMP_SPEED
    gm.PlaySound(gm.BOUNCE_SOUND, 1)
    If brck.disappearing Then
    brck.Shrink
    End If
    Exit
    End If
    End If
    Next
    End If
    If animator.vy < 0 AND mbd.DestRect.Top < 40%y Then
    'scroll the background
    gm.ScrollDown(-animator.vy / 1.5)
    mbd.DestRect.Top = mbd.DestRect.Top - animator.vy / 2
    mbd.DestRect.Bottom = mbd.DestRect.Bottom - animator.vy / 2
    End If
    'instead of ending the game we bounce the smiley
    If mbd.DestRect.Bottom >= 100%y Then animator.vy = JUMP_SPEED
    End Sub

    Public Sub StartAccelerometer
    Accelerometer.StartListening("Accelerometer")
    End Sub

    Public Sub StopAccelerometer
    Accelerometer.StopListening
    End Sub

    But I am getting complie error:

    Parsing code. 0.07
    Compiling code. Error
    Error compiling program.
    Error description: Unknown member: initialize2
    Occurred on line: 22
    Accelerometer.Initialize2(Accelerometer.TYPE_ACCELEROMETER, 0)
    Word: initialize2

    I am reading as much as I can but would love to have some help thanks
     
    Last edited: Mar 5, 2013
  11. atreyuatnz

    atreyuatnz New Member Licensed User

    No tilt action?

    Orientation is supported on my Samsung phone but I get this msg ( There is a problem parsing the package) I suspect that is because the Android version is 2.3.6
     
  12. Erel

    Erel Administrator Staff Member Licensed User

    This example requires Android 3+.
     
  13. giga

    giga Well-Known Member Licensed User

    Check out this variation of the Jumping Smiley ("Jumping Cube")
    3D cube effect.
    **Difference is the background and cube** code credit goes to Erel.

    Enjoy.
     

    Attached Files:

  14. Douglas Farias

    Douglas Farias Expert Licensed User

    this game show me some errors on my real device


    an error has occured in sub:
    java.lang.
    illegalargumentexception
    continue?

    later
    an error has occured in sub:
    smiley_startsensor
    java line 90
    continue?

    later
    smyle_tick have line 105


    and stop on this error *-*
     
  15. giga

    giga Well-Known Member Licensed User

    Does the original jumping smiley work on that device? I am using a samsung tab 7inch and a samsung galaxy III.
     
  16. Douglas Farias

    Douglas Farias Expert Licensed User

    original yes , i tested the erel example and give this error
    my device is galaxy star trios android 4.2
    aceleration - ORIENTATION suported
     
  17. Erel

    Erel Administrator Staff Member Licensed User

    Can you post the full error message from the logs?
     
  18. Douglas Farias

    Douglas Farias Expert Licensed User

    This error is in your exemple erel
    is in the device Galaxy Star Trios

    LogCat connected to: B4A-Bridge: samsung GT-S5283B-358417050448855
    --------- beginning of /dev/log/main
    PackageAdded: package:giga.pipe.com
    ** Activity (main) Resume **
    Installing file.
    ** Activity (main) Pause, UserClosed = false **
    PackageAdded: package:giga.pipe.com
    ** Activity (main) Create, isFirst = true **
    Error occurred on line: 151 (gamemanager)
    java.lang.IllegalArgumentException
    at java.util.Random.nextInt(Random.java:187)
    at anywheresoftware.b4a.keywords.Common.Rnd(Common.java:203)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:485)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:229)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at giga.pipe.com.main.afterFirstLayout(main.java:98)
    at giga.pipe.com.main.access$100(main.java:16)
    at giga.pipe.com.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 0
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at giga.pipe.com.main.afterFirstLayout(main.java:98)
    at giga.pipe.com.main.access$100(main.java:16)
    at giga.pipe.com.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 0
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at giga.pipe.com.main.afterFirstLayout(main.java:98)
    at giga.pipe.com.main.access$100(main.java:16)
    at giga.pipe.com.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 0
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at giga.pipe.com.main.afterFirstLayout(main.java:98)
    at giga.pipe.com.main.access$100(main.java:16)
    at giga.pipe.com.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 27
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at giga.pipe.com.main.afterFirstLayout(main.java:98)
    at giga.pipe.com.main.access$100(main.java:16)
    at giga.pipe.com.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: -36
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at giga.pipe.com.main.afterFirstLayout(main.java:98)
    at giga.pipe.com.main.access$100(main.java:16)
    at giga.pipe.com.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 0
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at giga.pipe.com.main.afterFirstLayout(main.java:98)
    at giga.pipe.com.main.access$100(main.java:16)
    at giga.pipe.com.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    ~e: at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 34
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at giga.pipe.com.main.afterFirstLayout(main.java:98)
    at giga.pipe.com.main.access$100(main.java:16)
    at giga.pipe.com.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    ** Activity (main) Resume **
    Error occurred on line: 151 (gamemanager)
    java.lang.NullPointerException
    at anywheresoftware.b4a.shell.Shell.getRemoteObjectValue(Shell.java:321)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:238)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
    at giga.pipe.com.main.afterFirstLayout(main.java:104)
    at giga.pipe.com.main.access$100(main.java:16)
    at giga.pipe.com.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 0
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
    at giga.pipe.com.main.afterFirstLayout(main.java:104)
    at giga.pipe.com.main.access$100(main.java:16)
    at giga.pipe.com.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 73
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
    at giga.pipe.com.main.afterFirstLayout(main.java:104)
    at giga.pipe.com.main.access$100(main.java:16)
    at giga.pipe.com.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: -24
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
    at giga.pipe.com.main.afterFirstLayout(main.java:104)
    at giga.pipe.com.main.access$100(main.java:16)
    at giga.pipe.com.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    ** Activity (main) Resume **
    ** Activity (main) Pause, UserClosed = false **
    libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
    sending message to waiting queue (CallSubDelayed - UpdateStatus)
    running waiting messages (1)
    ** Activity (main) Resume **
    ** Service (service1) Destroy **
    ** Service (service1) Create **
    ** Service (service1) Start **
    Connected to B4A-Bridge (Wifi)
    Installing file.
    ** Activity (main) Pause, UserClosed = false **
    PackageAdded: package:b4a.example
    ** Activity (main) Create, isFirst = true **
    Error occurred on line: 151 (gamemanager)
    java.lang.IllegalArgumentException
    at java.util.Random.nextInt(Random.java:187)
    at anywheresoftware.b4a.keywords.Common.Rnd(Common.java:203)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:485)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:229)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at b4a.example.main.afterFirstLayout(main.java:98)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 0
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at b4a.example.main.afterFirstLayout(main.java:98)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 0
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at b4a.example.main.afterFirstLayout(main.java:98)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 0
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at b4a.example.main.afterFirstLayout(main.java:98)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 27
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at b4a.example.main.afterFirstLayout(main.java:98)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: -36
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at b4a.example.main.afterFirstLayout(main.java:98)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 0
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at b4a.example.main.afterFirstLayout(main.java:98)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 34
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at b4a.example.main.afterFirstLayout(main.java:98)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    ** Activity (main) Resume **
    Error occurred on line: 151 (gamemanager)
    java.lang.NullPointerException
    at anywheresoftware.b4a.shell.Shell.getRemoteObjectValue(Shell.java:321)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:238)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
    at b4a.example.main.afterFirstLayout(main.java:104)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 0
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
    at b4a.example.main.afterFirstLayout(main.java:104)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: 73
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
    at b4a.example.main.afterFirstLayout(main.java:104)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)
    Error occurred on line: 151 (gamemanager)
    java.lang.RuntimeException: Unexpected command: -24
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:279)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
    at b4a.example.main.afterFirstLayout(main.java:104)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4963)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    at dalvik.system.NativeStart.main(Native Method)

    ** Activity (main) Pause, UserClosed = true **
    ** Activity (main) Resume **
     
  19. giga

    giga Well-Known Member Licensed User

    I am not sure where that error is coming from. Has anyone else got the Jumping Cube to work?
    It works on both of my samsung tab 7inch and a samsung galaxy III.:confused:
     
  20. Erel

    Erel Administrator Staff Member Licensed User

    Do you get this error with the example code?
     
Thread Status:
Not open for further replies.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice