Showing posts with label MIDP. Show all posts
Showing posts with label MIDP. Show all posts

Wednesday, April 16, 2008

A mobile Application

Though there are a lot of sample projects given with Netbeans IDE, I thought I could really demonstrate its full potential in MIDP through a simple step by step robust application design for a Celsius to Kelvin scale converter app for java enabled phone.
  1. Select File->New Project->Mobility->MIDP Application
  2. Set the project name as MobileConverter and remember to keep Set as main project and Create HelloMIDlet checked
  3. Select the emulator type, here we’ll tryout the Sun JAVA™ wireless. We’ll be right now programming for a default Color phone with the older CLDC 1.0 config and MIDP-1.0 profile(That’s what my phone supports). Click finish.
  4. Goto the Screen view and let us now. Click on the text and change its property to Hello, Welcome to Mobile Converter
  5. Goto Palette and drag and drop a text field item and label it as input.
  6. Drag an Ok command from the list of Commands and label it as Convert.
  7. Now goto the flow tab and drop in a new form. Name it as output form.
  8. Drag a back command and drop it on our new form. Draw connection lines as shown.
  9. Goto the screen tab, choose the new form and drop in a textfield to show our output.
  10. Now goto the source code. Write the following method in your MIDlet class.

public void setans()

{

float x=Float.parseFloat(textField.getString());

x+=273.15;

textField1.setString(String.valueOf(x));

textField.setString("0");

}

  1. Goto screen, in the new form right click and goto source. In the place where you find // write post-init user code here call the setans method by setans();
  2. You finally have your own mobile app. Click on build and then deploy. Your jar file will be generated in the dist folder. Transfer it to your java enabled phone and enjoy ;)

EXPLORING AROUND

Its only when you try around coding new things do you really understand where this IDE leads you on the context of one of the most powerful programming languages JAVA. Consider one of the really emerging fields of programming embedded systems and mobile phones. In the New Project window try out creating a MIDP Application from the Mobility Section. Press F6 to check the cool emulator :)


The following are notable improvements:
  • New Integrated UI for CLDC/MIDP and CDC development. The Mobility pack now supports the project properties previously available only for CLDC/MIDP projects. These include project configuration support for device fragmentation, integrated obfuscation and optimization support, and multiple deployment options, all built on Apache Ant for easier coding and management.
  • New game builder. Now it's easier to create mobile games with the Mobility Pack's visual editing support for the MIDP 2.0 Game API. The API supports animated sprites and the ability to arrange tiled layers into scenes.
  • New Visual Mobile Designer. The Visual Mobile Designer (VMD) has been re-designed for improved functionality and usability.
  • Design analysis. Design Analysis identifies unused components for removal from complex visual designs .
  • New custom components. New components for the Visual Mobile Designer simplify the creation and design of mobile file browsers, Short Message Service (SMS) composers, login screens, and Personal Information Manager (PIM) browsers.
  • New components for Flow Control.
  • Generated code is now easier to modify.

Netbeans 6.1 is all you could ever ask for! What else can you probably ask?