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());





  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 ;)


kapil said...

hey i tried to build the application using ur tutorial..its really great job with the tutorial. i just had one problem..when i transferred the executable jar file on my cell phone, it said invalid application..i tried to use different handsets too but it doesnt work..i wondering is it the emulator that is causing the prob ? because we use the default colorphone..if u any idea about it plz let me know.

Kiran Bhat said...

Dear Kapil,
Please use a Java enabled cellphone. Not all colour phones support java apps...

1 said...

hello i hava nokia n73 but i i complile JAR file!!1 & open it in n73 it says "NOT A VALID JAR FILE"

Harsh Chhatwani said...

can you please tell me how to select emulator type?i have already made a project and it is running successfully,now i want to install it in my mobile.please guide

Sagar said...

Hi Kapil,

Really i is appriciable to start such blog.

Right now I want to develop a mobile slam book like below:

after filling this information, msg will sent to predefined number.

Can you help me for the same.

best reg.

Amar Verma.

John said...

Hey its really amiging. Keep Sharing.

blackberry phone deals with free gifts

MLB2k11 said...

Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write ups thanks once again.
Android app development companies| Android phone app development|


Hey bro,nice post
I tried it and its working fine
its described nicely

vaibhav said...

can you please help me in including database connectivity in such an application. for example i want a login page and the entered info goes into the database... please its urgent

Kiran Bhat said...

read and this

ndok nandok said...

need help
i got this bug when i resubmit input the output is the same

Sami Dorro said...

I'm astounded. You're sincerely decently educated and extremely canny. I am set to bookmark this site.iPhone app builder // iphone applications // Android application development