Showing posts with label J2ME. Show all posts
Showing posts with label J2ME. Show all posts

Thursday, September 30, 2010

sample J2ME code


For mobile device we are going to use MIDlet,like application for computer, applet for the web
  • All J2ME programs require import.javax.microedition package
  • MIDlet it is an abstract class.
  • Any J2ME class any inherit  it,can override the methods in it..
  • MIDlet not support user interaction, display message,multi-threading support
Sample code

e.g
// my   midlet.java file
import javax.microedition.midlet;//for MIDlet
import javax.microedition.lcdui; //for UI
public void startApp()   // to start the application
{
}
public void pauseApp() // to halt the application for a while
{
}
public void destroyApp() // to destroy application
{
}
private void exit()             //to close the application
{
System.gs()//garbage collection
destroyApp(false)//invoke destroy method
notifyDestroyed()// to notify application about destroyed thing
}




Tuesday, September 28, 2010

MOBILE programming

Mobile programming
  •  Java 2 micro Edition J2ME is one of the version from Java ..
  • It is used for mobile phone, PDP’s programs..
e.g   of a mobile programming Drawing,controls,interaction,file handling..
Basic concepts for mobile programming..
  1.  Configuration 
  2.   Profile 
  3.    Optional package
These three things able to understand the java environment, java features ,API’s for mobile programming
Configuration:

Basically two types of configuration available

1)CLDC:  connected limited device configuration
  • It will support less memory devices like mobiles, with minimum no. of core classes
  • It   It contains JAVA VM(virtual machine), more core classes
2)CDC :   connected  device configuration
  • It will support large memory size devices:
  •  It contains java VM to execute byte code, to facilitate communication between native code and  mobile device..
Profile:
  • It contains  device specific ,add more functionality,U I classes
CLDC:   It contains two  profiles:
1)       
  1.        MIDP:       mobile information device profile 
  2.         PDAP:         personal digital assistant profile: it is improved over MIDP with more UI classes
CDC:
  • It also contains two profiles:
  1. FP Foundation profile: It contains more UI (user interface)classes
  2.  PBP Personal Basis profile: It extend from FB with JAVA AWT control..
  • Now recent profile is personal profile (PP)..
Optional package
  • It is more specific to particular device, it contains additional PI’s when compared to profiles..
  •  Core classes not only inherited from configuration, but also from profiles and optional packages..
e..g Bluetooth API we made it as optional package..part of a profile, then profile is oriented to Bluetooth enabled device ..
ΓΌ                                     But mostly we employ CLDC with MIDP profile..
         
        .......>  This will continue further.read more.<.............