Wednesday, November 28, 2007

Midlets using MotoDev Studio

MotoDev Studio is a new IDE platform to develop J2ME applications for Motorola phones.

I just did a basic test using this.

Prerequiresites:

  1. Install latest JDK SE
  2. Install MotoDevStudio

Build Steps:

  1. Launch MOTODEV Studio for Java(TM) ME v1.0
  2. Create a new project
  3. Select Phone type
  4. Create a package under src folder. (not necessary, but a good practice. else default package will be selected)
  5. Create class
  6. Add code (simple hello world using LCDUI)

    package MyPackage;

    import javax.microedition.lcdui.*;

    import javax.microedition.midlet.*;

    public class HelloWorld extends MIDlet
    {
        private Form mainScreen;

        private Display myDisplay;
       

       public HelloWorld()
        {
            myDisplay = Display.getDisplay(this);

            mainScreen = new Form("Hello World");

            StringItem strItem = new StringItem("Hello","This is a J2ME MIDlet.");

            mainScreen.append(strItem);
        }
        /**
         * Start the MIDlet
         */
        public void startApp() throws MIDletStateChangeException
        {
            myDisplay.setCurrent(mainScreen);
        }

        /**
         * Pause the MIDlet
         */
        public void pauseApp()
        {

        }

        /**
         * Called by the framework before the application is unloaded
         */
        public void destroyApp(boolean unconditional)
        {

        }
    }

  7. Edit Jad file MyMidlet.Jad; Goto Midlets tab (below); Add Midlets e:g MidletName,icon,Package.Class
  8. Build project, default setting is autobuild
  9. Create Package;Rightclick on MyMidlet Project (root element), From pulldown menu click J2ME and click on select CretePackage
  10. If everything goes well you should have MyMidlet.jar and MyMidlet.Jad files in ~:\Documents and Settings\user\workspace\MyMidlet\deployed
  11. Use MidletManager or your favourite tool to install this midlet
  12. Restart phone and test midlet

Note: This is without signing

Monday, November 26, 2007

VIM ftp editing

VIM supports easy editing of remote files.
Just Open ftp://domain.tld/path/to/file
It prompts for username and password!!!