Beautifying your mobile application

In this recipe we will show ways to improve the look and behavior of our mobile application.

One of the things developers will surely do when their application goes into production is brand the application with the icon of the company or development group, for a more professional look.

Getting ready

First we need to find an icon that we can use for the application.

For our application icon we can use this site to find images:

http://search.creativecommons.org/

How to do it...

Creating the project:

  1. Create a new project, this can be achieved by either clicking File and then New Project or by pressing Ctrl+Shift+N.
  2. On the New Project window on categories side choose Java ME and on Projects side select Mobile Application and click Next.
  3. Under Name and Location: Name the project as MyPrettyMobileApp, leave the other options with their default values and click Next.
  4. Under Default Platform Selection: On Emulator Platform select Java(TM) Platform Micro Edition SDK 3.0.
  5. Under Device select DefaultCldcPhone1 and click Finish.

Creating the images package:

  1. Under the Projects window right-click in the Source Package.
  2. Select New and click on Java Package....
  3. On the New Java Package window, name the package as images and click Finish.
  4. Move all of the images that are going to be used in this package.

Now we will be adding an icon:

  1. Right-click on the project and select Properties.
  2. On the Properties window, click in Libraries & Resources and click on Add Folder....
  3. Navigate to the images folder and click Open.
  4. Then navigate to Application Descriptor and click on the MIDlets tab.
  5. Select our HelloMIDlet and click Edit....
  6. Clicking on the MIDlet Icon drop-down will show the image file.
How to do it...

Click OK from the Edit MIDlet window and the IDE will refresh the icon in our HelloMIDlet class.

How it works...

By adding the icon to our mobile applications' libraries & resources we have made it possible for the image to be accessed by our code and IDE.

The Resources folder will show the available folder and contents when returning to the main window of the IDE.

The project.properties file is updated with the information containing the image:

manifest.midlets=MIDlet-1: HelloMIDlet,/frog.png,hello.HelloMIDlet

The image is shown when the MIDlet is run, and by exiting our application the listed MIDlet with the image is shown.

How it works...
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.197.135