×

Discussion Board

Results 1 to 3 of 3

Hybrid View

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    1

    Can i fix error about com.nokia.mid.ui.orientation.Orientation

    Now i have been used Nokia 500
    and i upgraded to sybian belle last week

    i have tried to programming "the test of game." and i want to use landscape screen.

    this code is:


    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */
    package newpackage;

    //import java.lang.*;
    import com.nokia.mid.ui.orientation.Orientation;
    import com.nokia.mid.ui.orientation.OrientationListener;
    import javax.microedition.lcdui.*;
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.microedition.media.Player;

    /**
    * @author DemoMS
    */
    public class Ironman extends GameCanvas implements Runnable, OrientationListener {
    //public class Ironman extends GameCanvas implements Runnable, OrientationListener {
    // class Ironman extends GameCanvas implements Runnable {
    /**
    * constructor
    */



    private Player player1 = null;
    private Player player2 = null;
    private Image img1 = null;
    private Image img2 = null;
    private Image Pad = null;
    private Image Arrow_UP = null;
    private Image Arrow_DOWN = null;
    private Image Arrow_LEFT = null;
    private Image Arrow_RIGHT = null;
    private Image Arrow_LEFT_UP = null;
    private Image Arrow_RIGHT_UP = null;
    private Image Arrow_LEFT_DOWN = null;
    private Image Arrow_RIGHT_DOWN = null;
    private String str1 = "Iron Man Animation. No Input";
    private String str2 = "You Press ";
    private Font fnt1 = null;
    private Font fnt2 = null;
    private Image iron_img[] = new Image[35];
    private boolean pressed_state = false;
    private Thread th = new Thread(this);
    private int picindex = 0;
    private int keyinputs = 0;
    private int delay_time = 100;
    private int key = 0;
    private int current_x = 0;
    private int current_y = 60;
    private int count_jump = 0;
    private boolean keypressed = true;
    private boolean run_state = false; //==== false = left direction / true = right direction
    private boolean direction = false;
    private int action_state = 0; //========= (0=idle/1=run/2=punch/3=jump/4=beam/5=etc;
    private int Current_X = 0;
    private int Current_Y = 0;
    private String TmpState = "";


    public Ironman() {
    // try {
    // // Set up this canvas to listen to command events
    // setCommandListener(this);
    // // Add the Exit command
    // addCommand(new Command("Exit", Command.EXIT, 1));
    // } catch (Exception e) {
    // e.printStackTrace();
    // }



    super(true);
    //str2 = Integer.toString(Orientation.ORIENTATION_LANDSCAPE);

    //Orientation.setAppOrientation(Orientation.ORIENTATION_LANDSCAPE);
    //str2 = Integer.toString(Orientation.getAppOrientation());
    this.setFullScreenMode(true);
    Orientation.addOrientationListener(this);
    //Orientation.setAppOrientation(2);
    try
    {

    //this.sizeChanged(getWidth(), getHeight());

    // int jj = 0;
    // jj = getKeyStates();
    // iron_img[0] = Image.createImage("/ironman/iron_run_01.png");
    // iron_img[1] = Image.createImage("/ironman/iron_run_02.png");
    // iron_img[2] = Image.createImage("/ironman/iron_run_03.png");
    // iron_img[3] = Image.createImage("/ironman/iron_run_04.png");
    // iron_img[4] = Image.createImage("/ironman/iron_run_05.png");
    // iron_img[5] = Image.createImage("/ironman/iron_run_06.png");
    // iron_img[6] = Image.createImage("/ironman/iron_run_07.png");
    // iron_img[7] = Image.createImage("/ironman/iron_run_08.png");
    // iron_img[8] = Image.createImage("/ironman/iron_run_09.png");
    // iron_img[9] = Image.createImage("/ironman/iron_run_10.png");
    // iron_img[10] = Image.createImage("/ironman/iron_run_11.png");
    // iron_img[11] = Image.createImage("/ironman/iron_run_12.png");
    // iron_img[7] = Image.createImage("/ironman/iron_run_08.png");
    // iron_img[8] = Image.createImage("/ironman/iron_run_09.png");
    // iron_img[9] = Image.createImage("/ironman/iron_run_10.png");
    // iron_img[10] = Image.createImage("/ironman/iron_run_11.png");
    // iron_img[11] = Image.createImage("/ironman/iron_run_12.png");

    iron_img[0] = Image.createImage("/ironman/idle_00.png");
    iron_img[1] = Image.createImage("/ironman/idle_01.png");
    iron_img[2] = Image.createImage("/ironman/idle_02.png");
    iron_img[3] = Image.createImage("/ironman/idle_03.png");
    iron_img[4] = Image.createImage("/ironman/idle_04.png");
    iron_img[5] = Image.createImage("/ironman/idle_05.png");
    iron_img[6] = Image.createImage("/ironman/idle_06.png");
    iron_img[7] = Image.createImage("/ironman/punch_00.png");
    iron_img[8] = Image.createImage("/ironman/punch_01.png");
    iron_img[9] = Image.createImage("/ironman/punch_02.png");
    iron_img[10] = Image.createImage("/ironman/punch_03.png");
    iron_img[11] = Image.createImage("/ironman/punch_04.png");
    iron_img[12] = Image.createImage("/ironman/punch_05.png");
    iron_img[13] = Image.createImage("/ironman/punch_06.png");
    iron_img[14] = Image.createImage("/ironman/run_00.png");
    iron_img[15] = Image.createImage("/ironman/run_01.png");
    iron_img[16] = Image.createImage("/ironman/run_02.png");
    iron_img[17] = Image.createImage("/ironman/run_03.png");
    iron_img[18] = Image.createImage("/ironman/run_04.png");
    iron_img[19] = Image.createImage("/ironman/run_05.png");
    iron_img[20] = Image.createImage("/ironman/run_06.png");
    iron_img[21] = Image.createImage("/ironman/run_07.png");
    iron_img[22] = Image.createImage("/ironman/run_08.png");
    iron_img[23] = Image.createImage("/ironman/run_09.png");
    iron_img[24] = Image.createImage("/ironman/jump_00.png");
    iron_img[25] = Image.createImage("/ironman/jump_01.png");
    iron_img[26] = Image.createImage("/ironman/jump_02.png");
    iron_img[27] = Image.createImage("/ironman/jump_03.png");
    iron_img[28] = Image.createImage("/ironman/jump_04.png");
    iron_img[29] = Image.createImage("/ironman/jump_05.png");
    iron_img[30] = Image.createImage("/ironman/jump_06.png");
    iron_img[31] = Image.createImage("/ironman/jump_07.png");
    iron_img[32] = Image.createImage("/ironman/jump_08.png");
    iron_img[33] = Image.createImage("/ironman/jump_09.png");
    Pad = Image.createImage("/ironman/Pad_Png.png");
    Arrow_LEFT = Image.createImage("/ironman/arrow_left.png");
    Arrow_LEFT_UP = Image.createImage("/ironman/arrow_left_up.png");
    Arrow_LEFT_DOWN = Image.createImage("/ironman/arrow_left_down.png");
    Arrow_UP = Image.createImage("/ironman/arrow_up.png");
    Arrow_RIGHT = Image.createImage("/ironman/arrow_right.png");
    Arrow_RIGHT_UP = Image.createImage("/ironman/arrow_right_up.png");
    Arrow_RIGHT_DOWN = Image.createImage("/ironman/arrow_right_down.png");
    Arrow_DOWN = Image.createImage("/ironman/arrow_down.png");
    // iron_img[24] = Image.createImage("/ironman/run_10.png");
    //current_x = getWidth() / 2;
    //current_y = getHeight() / 2;


    //Orientation.setAppOrientation(Orientation.ORIENTATION_LANDSCAPE);
    StartThread();
    }
    catch (Exception ex)
    {
    System.out.print("Error");
    }
    }


    public void displayOrientationChanged( int newDisplayOrientation ){

    switch( newDisplayOrientation ){
    ////////// case Orientation.ORIENTATION_PORTRAIT:
    ////////// case Orientation.ORIENTATION_PORTRAIT_180:
    ////////// /** Suspend rendering until orientation has been changed */
    ////////// //////////canDraw = false;
    //////////
    ////////// /** Change MIDlet UI orientation to portrait */
    ////////// //////////synchronized( drawLock )
    ////////// {
    ////////// Orientation.setAppOrientation( Orientation.ORIENTATION_PORTRAIT );
    ////////// }
    ////////// break;
    //////////
    ////////// case Orientation.ORIENTATION_LANDSCAPE:
    ////////// case Orientation.ORIENTATION_LANDSCAPE_180:
    ////////// /** Suspend rendering until orientation has been changed */
    ////////// //////////canDraw = false;
    //////////
    ////////// /** Change MIDlet UI orientation to landscape */
    ////////// //////////synchronized( drawLock )
    ////////// {
    ////////// Orientation.setAppOrientation( Orientation.ORIENTATION_LANDSCAPE );
    ////////// }
    //////////
    ////////// break;
    }
    }

    }


    i can run it on nokia sdk 2.0 emulator (Asha series)
    but when i have been install my code (jar/jad) i cannot to run it on my phone. (i can complete install to my phone.)

    Thank you very much.

  2. #2
    Nokia Developer Expert
    Join Date
    May 2012
    Location
    Espoo
    Posts
    224

    Re: Can i fix error about com.nokia.mid.ui.orientation.Orientation

    Hi benher1st and Welcome to Nokia discussion boards,

    one possible suspect is missing resources(images) in the jar file. create new jar by commenting image creation code and install on the device to see same behavior or not

  3. #3
    Nokia Developer Expert
    Join Date
    Aug 2011
    Posts
    555

    Re: Can i fix error about com.nokia.mid.ui.orientation.Orientation

    Hi benher1st,

    Please keep in mind that the Orientation API is only supported on Series 40 Java Runtime 2.0.0 devices (full touch), not on Symbian Belle.

    You could alternatively use the Sensor API in order to access the accelerometer for measuring acceleration on the X, Y and Z axis when the device is flipped on Symbian Belle.

Similar Threads

  1. Control the orientation with "runtime.orientation"
    By cymerio in forum [Archived] Qt Quick
    Replies: 4
    Last Post: 2011-03-11, 09:35
  2. Nokia-MIDlet-App-Orientation
    By hting in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2010-02-25, 00:52
  3. portrait orientation and landscape orientation in N96
    By videoFx in forum [Archived] Flash Lite on Nokia Devices
    Replies: 0
    Last Post: 2009-05-20, 15:13
  4. Tag Nokia-MIDlet-App-Orientation in JAD on S60 5th
    By Creator3D in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2009-01-03, 18:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×