Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Sir
I am new with J2ME and eclipseIDE I have completed my Mobile Application approximately
but now I face a problem I have to connect it first and when exit I minimized it and messaging is continuous now I wish to receive these messages and When I restore it then All updates is taken by it during restoring but in this it display an java.IO.lang error I have tagged code with this pl help me in this because this is the only part is remaining in my application
the code is given below
C#
public void startApp() {
           String connectList[];
           // Was the MIDlet started by an incoming connection?
           connectList = PushRegistry.listConnections(true);

           if (connectList == null || connectList.length == 0){

              try{
                    _display = Display.getInstance();
                    ImplementationFactory.setInstance(new MyImplementationFactory());
                    VKBImplementationFactory.init();
                    Display.init(this);
                     try{
                           incomingConnection = (MessageConnection) Connector.open(ConnectionString);
                           this.incomingConnection.setMessageListener(this);
                       }catch(Exception e){
                                 Dialog.show("SMS Exception","IO Exception!"+e.toString(),"OK", null);
                       }
                       setDefaultImage();
                       screens.main_Screen();
                       screens.mainMenu.show();
               }catch(Exception ex){
                   Dialog.show("Application Error","Low Memory, Minimum requirement is 800 kb "+ex.getMessage(),"Ok", null);
               }
           } else{  // Started from an incoming connection
               _display = Display.getInstance();
                ImplementationFactory.setInstance(new MyImplementationFactory());
                VKBImplementationFactory.init();
                       Display.init(this);
                       _display.showNotify();
                       _display.restoreMinimizedApplication();
                       add_Push_Registry(); //  Do implement the SMS received interface


           }
  }

///////////this is for minimizing and exit
C#
public void close_App(){
            System.gc();                    //Close the application
//         destroyApp(true);
//         notifyDestroyed();
       _display.minimizeApplication();  //Minimize the application
    }

/////////this is for setting push registry for restoring ////////
C#
private void add_Push_Registry()    {
       try{                                                  //Register with PushResigtry

         String MIDletRegistered = PushRegistry.getMIDlet(ConnectionString);
         incomingConnection = (MessageConnection) Connector.open(ConnectionString);
         this.incomingConnection.setMessageListener(this);

         if(MIDletRegistered == null){
               Dialog.show("IS Zigbee MIDlet Registered","NULL","OK", null);
               PushRegistry.registerConnection(ConnectionString, GetMIDletClassName(), "*");
         }else{
               if(!MIDletRegistered.equals(GetMIDletClassName()))
                       Dialog.show("Midlet listen","Port for receiving SMS is already occupied by some other application",
                               "OK", null);
        }
      }catch(Exception e){
                 Dialog.show("EX","IO Exception!"+e.toString(),"OK", null);
      }
   }




thanks
Om Parkash J2ME developer
Posted
Comments
Nagy Vilmos 12-Dec-11 11:05am    
Are you sure you mean minimise? AFAIK, there can only be one active app at a time, and when you wish to release the screen, the app is hidden or paused.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900