Dialog in a Thread

hi,
I'm having problems displaying a JDialog. I have an operation in my code which takes a long time, i.e upload to a server. I want to display a dialog before the up load begins informing the user that the upload is happening. Then when the operation is complete I want to destroy the dialog. Problem is that the dialog is never displayed properly before the upload operation is complete! I have tried puting the dialog in a Runnable object and using the invokeLater() function but the dialog is not displayed until the operation is complete. I have also tried creating a new Thread and calling the runnable object with invokeAndWait but again the Dialog does not display until the operation is complete. Can anyone help!!!
Thanks in advance.
Stephen

I have a similar problem. I have a WaitDialog that extends Dialog and implements Runnable. the run method calls this.setVisible( true ). In the constructor of my main window, I create a new thread with my WaitDialog (new Thread(WaitDialog).start();) at the top of the constructor, and initialize all swing components. This process takes a while. The WaitDialog is displayed with no components until the main window is visible. i.e end of constructor. I have tried different parents and modal combinations with no success. I have also tried using SwingWorkers instead of my Runnable.
Has anyone seen this before?

Similar Messages

  • How to pop up a Modal dialog on the top.

    Hi ALL,
    I want to pop up a dialog from background thread, and make it on the top level, any suggestion please.
    First: JFrame.show(), and then start a background thread to monitor some event.
    when the event happen, it will start to pop up a warning message, the user has to response to it.
    otherwise user can not do anything, however the background is still running.
    I want to use JOptionPanel, but it seem does not work good.
       _timer = new Timer(30*1000, new ClockListener());
      class ClockListener implements ActionListener {
            public void actionPerformed(ActionEvent e) {
                    if(event)
                      popUpDialog();
    .........Thanks in advanced!

    Use a SwingWorker. Do the backgrround monitoring in a while(true) loop (with a Thread.sleep) in doInBackground. Invoke process when your event is detected and show the dialog from publish.
    db

  • How to display a modal message while processing in a thread.

    I have difficulty in display a modal dialog while in processing in a background.
    I have created the following class.
    package fedex.screen.component;
    import java.awt.*;
    // This infobox is a modal dialog which display static text and stay
    // on screen without blocking proceeding code from execution and can
    // only close by issuing close method.
    public class ProcessInfoBox implements Runnable
         // Display dialog box
         private InfoBox dialog = null;
         // Thread to enable showing of Dialog Box
         private Thread thread = new Thread(this);
         // Determine if to close dialogbox
         private boolean isFinish = false;
         public ProcessInfoBox(Frame frame) {
              dialog = new InfoBox(frame,"Performing Operation","Processing...");
    thread.setPriority(Thread.MAX_PRIORITY);
         public void setTitle(String title) {
              dialog.setTitle(title);
         public void setText(String text) {
              dialog.getMessageLbl().setText(text);
         // The reference return will be ProcessInfoBox.InfoBox
         public InfoBox getInfoBox() {
              return dialog;
         // Thread method
         public void run() {
              dialog.setVisible(true);
              // If true return from thread and exit.
              while ( isFinish == false )
                   try
                        Thread.sleep(500); // 500 msec
                   catch ( InterruptedException e )
         // Start showing dialog
         final public void show() {
              thread.start();
              isFinish = false;
         final public void hide() {
              isFinish = true;
              dialog.setVisible(false);
         // Dialog box which show text.
         public class InfoBox extends Dialog
              private Label messageLbl = new Label("Processing ...");
              public InfoBox(Frame frame, String title, String message) {
                   super(frame,title,true);
                   initInfoBox();
              public Label getMessageLbl() {
                   return messageLbl;
              private void initInfoBox() {
                   setLayout(new BorderLayout());
                   add(messageLbl,BorderLayout.CENTER);
                   setSize(250,150);
    FormUtility.centerForm(this);
         public static void main(String[] args) {
              Frame frame = new Frame("BigMac");
              frame.setSize(600,600);
              frame.setVisible(true);
              ProcessInfoBox box = new ProcessInfoBox(frame);
              box.show();
              for ( int i = 1; i < 10000; i++ )
                   System.out.println(i);
              box.hide();
    To test the code I used the following section to test
    The main method in the class is used. In the simple
    example, the message did correctly update itself while
    i is increment. However, when I try on more complex
    application, the message just stalk there without
    updating itself as it is hanging.
    I have try to set piority to highest but without effect.
    Is there anything to rectify the situation
    thank

    The "please wait" dialog is a modal dialog. When u
    show it, the following code can not executed!
    That's the problem

  • Unable to close OK button of JOption dialog when 2 dialogs are displayed.

    1. Run the below sample program
    2. Click the "Click me" button immediately.
    3. two dialogs are displayed, one by mouse click and another by threa.d
    4. Now OK button of both dialogs are not working.
    Expected behaviour:
    the ok button of second dialog shold be active and should close the dialog.
    Sample:
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    public class test
         public static void main(String arg[])
              MainFrame frm1 = new MainFrame();
              frm1.setVisible(true);
    class MainFrame extends JFrame implements Runnable, ActionListener
         messagedlg errdlg = new messagedlg();
         JButton btn;
         MainFrame()
              btn = new JButton("Click Me");
              JPanel pnl = new JPanel();
              this.getContentPane().add(pnl);
              pnl.setLayout(new FlowLayout());
              pnl.add(btn);
              btn.addActionListener(this);
              setSize(400,400);          
              setLocation(400,200);
              Thread t = new Thread(this);
              t.start();          
         public void run()
              errdlg.showError(this,"mainscreen message");
         public void actionPerformed(ActionEvent ae)
              System.out.println("action start");
    //          SwingUtilities.invokeLater(Thread.currentThread());
              errdlg.showError(this,"mainscreen action message");
              System.out.println("action end");
    class messagedlg
         public static void showError(JFrame frame, String msg)
              try{Thread.sleep(1000);}catch(Exception ex){}
              Object[] options = {"OK"};
              int n = JOptionPane.showOptionDialog(frame,(Object)msg, msg,
                   JOptionPane.OK_OPTION,1,
              null,     //don't use a custom Icon
              options,  //the titles of buttons
              options[0]); //default button title
    }

    Some things you need to know.
    1. NEVER create or modify UI objects outside of the event dispatch thread (EDT) - you are doing this when you pop up the dialog on the new thread
    2. NEVER sleep on the EDT - you are doing this when you respond to the action event
    3. When you make mistake number 1, if you feed the same root frame to two modal dialogs on different threads then, well, on your head be it
    Some reading for you, before you get into more trouble ;o)
    http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html

  • Find already opened modal dialog

    Dear Friends,
    I have opened the modal dialog through some action. But in my application
    there is a chance for opening Modal dialog from other thread (due to some notification from server). Is there any way to check programatically, whether the modal dialog is already opened or not. If any one knows please help me, It is very urgent.
    Thanks,
    V.S.Saravanan

    hi,
    what about this:
    public class MyMessageShower
      private static boolean isShowing = false;
      public static void showErrorMessage ()
        isShowing = true;
        JOptionPane.showMessageDialog (...);
        isShowing = false;
      public static boolean isShowing ()
        return isShowing;
    }greetz,
    Stijn

  • Duplicate message dialogs

    Hi,
    I am outputting a message dialog from a thread within an applet.
    However when I do this, I aleways get two dialogs the same, one
    hidden behind the applet.
    I assume that since it normally only produces one dialog, it has
    something to do with the thread.
    Does anyone have any ide how to resolve this problem ?
    Sue

    I can't reproduce your problem. I downloaded SwingWorker 3 and used this code:import java.awt.*;
    import javax.swing.*;
    public class Test extends JApplet {
        public void init () {
            new SwingWorker () {
                public Object construct () {
                    return new ArchiveRestorePullTask ();
            }.start ();
            getContentPane ().add (new JLabel ("Just testing...", SwingConstants.CENTER));
        private class ArchiveRestorePullTask {
            public ArchiveRestorePullTask () {
                try {
                    Thread.sleep (5000);
                } catch (InterruptedException exception) {}
                if (true) {
                    Toolkit.getDefaultToolkit ().beep ();
                    JOptionPane.showMessageDialog (Test.this, "Archive complete", "Archive complete", JOptionPane.INFORMATION_MESSAGE, null);
    }Kind regards,
      Levi

  • Displaying an Indeterminate Progress Bar While a DB2 Stored Proceedure Runs

    How do I display a dialog with an indeterminate progress bar while a DB2 query runs? Could anyone point me to an example or some strong docs?
    I learned Java about six months ago, so I'm relatively new to the language. Through searching and documentation, I've been able to find all the examples and answers I've needed so far. Now I've run into an issue I can't find anywhere. It seems like the most basic thing in the world. I have a DB2 stored procedure that takes about 5 minutes to run. While it's running, I want to display a simple dialog with a progress bar going back and forth (no buttons, no user interaction).
    I'm using Eclipse 3.3.1.1 as my IDE, and running the application from a JAR file. I have Java 1.6.0.30 installed. The DB2 query is running in response to a user clicking a button on the form (an ActionEvent). All of my forms are using Swing (JFrame, JDialog, etc.).
    The crux of my problem seems to be that I can bring up a dialog (which should contain the progress bar), but I can't get it to paint. All I get is a window that's the right size/location, but contains an after-image of what was behind it. I can't even get a dialog to display with a "Please Wait" label while the DB2 procedure runs.
    I tried separating both the DB2 stored procedure and the progress dialog into separate threads. I tried yielding in the DB2 thread to give the progress dialog a chance to update. I tried using invokeAndWait, but I got the following error:
    Exception in thread "AWT-EventQueue-0" java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread
    It seems like I'm doing something wrong in my use of Theads, but I can't for the life of me figure out what it is. If anyone could help out a bit of a Java newbie, I would be extremely grateful.

    Demo:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ProgressBarExample2 {
        private JProgressBar bar = new JProgressBar(0,99);
        private JButton button = new JButton("Lengthy operation");
        private ActionListener al = new ActionListener(){
           public void actionPerformed(ActionEvent evt) {
                button.setEnabled(false);
                bar.setIndeterminate(true);
                new Worker().execute();
        private class Worker extends SwingWorker<Boolean, Boolean>{
            protected Boolean doInBackground() {
                try {
                    Thread.sleep(10000); //10 secs
                } catch (InterruptedException e) {
                return Boolean.TRUE;
            protected void done() {
                button.setEnabled(true);
                bar.setIndeterminate(false);
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new ProgressBarExample2();
        ProgressBarExample2() {
            button.addActionListener(al);
            JPanel cp = new JPanel();
            cp.add(button);
            cp.add(bar);
            JFrame f = new JFrame("ProgressBarExample2");
            f.setContentPane(cp);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • Swing doesn't refresh/repaint properly

    Hi,
    I'm trying to display a very simple dialog that just about says "Please wait" while I do i/o extensive processing, and can't for the life of me succeed. I tried many things, including Threads, SwingWorker, to no avail. Something seems fishy in that I would expect a window that is setVisible(true) to be completely painted before processing resumes, but in all my cases the window comes up empty while the work gets done.
    Is there something special that I should do?
    Similarly, sending a somedialog.setVisible(false) before doing some I/O work erases the window but leaves the background erased, i.e. the underlying window doesn't refresh. How can I ensure that any GUI stuff is finished before resuming the processing?
    Thanks

    Sorry, I just noticed that only half of my code got pasted:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class DialogWait extends JFrame implements ActionListener
         public DialogWait()
              JButton button = new JButton("Start Long Running Task");
              button.addActionListener( this );
              getContentPane().add( button );
         public void actionPerformed(ActionEvent e)
              JDialog dialog = new JDialog(this, "Please Wait Test", true);
              dialog.getContentPane().add( new JLabel("Please wait for 5 seconds...") );
              dialog.pack();
              dialog.setLocationRelativeTo( this );
              Thread longRunningTask = new MyThread( dialog );
              longRunningTask.start();
              dialog.setVisible( true );
              dispose();
         class MyThread extends Thread
              JDialog dialog;
              public MyThread(JDialog dialog)
                   this.dialog = dialog;
              public void run()
                   long start = System.currentTimeMillis();
                   long current = start;
                   // Tight loop to hog CPU
                   while (current - start < 5000)
                        current = System.currentTimeMillis();
                   System.out.println( "Long task finished" );
                   dialog.setVisible( false );
         public static void main(String[] args)
              JFrame frame = new DialogWait();
              frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              frame.pack();
              frame.setLocationRelativeTo( null );
              frame.setVisible(true);
    }Notice my code is in a tight loop which should hog the CPU more than even doing heavy I/O should. Mind you on my computer the CPU only maxes out at 50%. So maybe thats why it works for me.
    Yes I tried something very similar, Well, don't try something similiar, try something exactly the same. (ie. does my program work on your machine?) If so, then the way you coded you other examples is wrong and we can't help since you haven't posted simple demo code that doesn't work.
    http://www.physci.org/codes/sscce.jsp

  • SMP 2.3 sp4 Synchronization in the native application on HTTPS

    Hi I have a big problem with synchronization on port 443 / https.
    This is the architecture.
    At the Relay Server I have installed a trusted certificate in IIS.
    I do not know what I need to use the certificate in SMP and application code.

    My code looks like this:
    SMP101DB.java
    _profile.getSyncProfile().setProperty("packageName","smp101:1.0" );
            com.sybase.persistence.ConnectionProfile initProfile = new com.sybase.persistence.ConnectionProfile();
            initProfile.setServerName("company.com");
            initProfile.setPortNumber(443);
            initProfile.setNetworkProtocol("https");
            initProfile.setNetworkStreamParams("trusted_certificates=;url_suffix=;custom_header=\"X_SUP_APPCID:" + com.sybase.mo.MessagingClientLib.getInstance().getDeviceID()+ "\"");
            initProfile.setDomainName("default");
            getSynchronizationProfile().setServerName("company.com");
            getSynchronizationProfile().setPortNumber(443);
            getSynchronizationProfile().setNetworkProtocol("https");
            com.sybase.persistence.NetworkStreamParams streamParams = getSynchronizationProfile().getStreamParams();
            Log.e("DJAR", streamParams.toString());
            streamParams.setUrl_Suffix("/ias_relay_server/client/rs_client.dll/rbs.farm");
            streamParams.setTrusted_Certificates("/storage/sdcard0/download/certificate_company.crt");
            getSynchronizationProfile().setDomainName("default");
            DELEGATE.setInitialSyncProfile(initProfile);
            DELEGATE.init("smp101:1.0", "com.test.smp101.android.mbo", META_DATA, _profile, getDSI());
    SMP101SampleActivity.java
    private static final int REQUEST_DETAIL = 99;
        private static String USERNAME = "yyyy";
        private static String PASSWORD = "xxxx";
        private static String HOST = "company.com";
        private static int PORT = 443;
        private static int TIMEOUT = 600;
        private static String networkStreamParamsRBS = "trusted_certificates=/storage/sdcard0/download/certificate_company.crt;url_suffix=/ias_relay_server/client/rs_client.dll/rbs.farm/";
        private static String networkStreamParamsMBS = "url_suffix=/ias_relay_server/client/rs_client.dll/mbs.farm/";
        private CustomerListAdapter adapter;
        private static volatile boolean initializationDone = false;
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState)
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            initializeApplication();
        protected void onActivityResult(int requestCode, int resultCode, Intent data)
            if (requestCode == REQUEST_DETAIL)
                if (resultCode == RESULT_OK)
                    SMP101SampleActivity.this.adapter.refreshUI(true);
        private void initializeApplication()
            final ProgressDialog dialog = new ProgressDialog(this);
            dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            dialog.setTitle("on boarding ...");
            dialog.setMessage("Please wait while download initial data...");
            dialog.setIndeterminate(false);
            dialog.setProgress(100);
            dialog.setCancelable(true);
            dialog.show();
            new Thread()
                @Override
                public void run()
                    try
                        int count = 0;
                        while (!initializationDone)
                            dialog.setProgress(++count);
                            Thread.sleep(500);
                            if (count == 100)
                                count = 0;
                        dialog.cancel();
                    catch (Exception e)
                        dialog.cancel();
            }.start();
            Application app = Application.getInstance();
            app.setApplicationIdentifier("SMP101");
            app.setApplicationContext(SMP101SampleActivity.this);
            new Thread(new Runnable()
                private void startLogon() {
                    Application app = Application.getInstance();
                    ApplicationCallback appCallback = new MyApplicationCallback();
                    SMP101DB.registerCallbackHandler(new CustomerDBCallback());
                    app.setApplicationCallback(appCallback);
                    SMP101DB.setApplication(app);
                    // Connection Profile
                    ConnectionProfile connProf = SMP101DB.getConnectionProfile();
                    connProf.setCacheSize(102400);
                    connProf.setNetworkProtocol("https");
                    Application.getInstance().getConnectionProperties().setFarmId("mbs.farm");
                    connProf.save();
    //                Application app = Application.getInstance();
    //                SMP101DB.registerCallbackHandler(new CustomerDBCallback());
    //                SMP101DB.setApplication(app);
    //                SMP101DB.getSynchronizationProfile().setServerName(HOST); // Convenience only
                    // Synchronization Profile
                    ConnectionProfile connProps = SMP101DB.getSynchronizationProfile(); //app.getConnectionProperties();
    //                LoginCredentials loginCredentials = new LoginCredentials(USERNAME, PASSWORD);
    //                connProps.setLoginCredentials(loginCredentials);
                    connProps.setServerName(HOST);
                    connProps.setPortNumber(PORT);
                    connProps.setNetworkProtocol("https");
                    connProps.enableTrace(true);
                    connProps.setMaxDbConnections(6);
                    connProps.setNetworkStreamParams(networkStreamParamsRBS);
                    connProps.save();
                @Override
                public void run()
                    try
                        Application app = Application.getInstance();
                        // ConnectionProperties
                        ConnectionProperties prop = app.getConnectionProperties();
                        prop.setServerName(HOST);
                        prop.setPortNumber(PORT);
                        prop.setNetworkProtocol("https");
                        prop.setFarmId("mbs.farm");
                        Log.i("SMP101","Starting Application Registration");
                        if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED) {
                            startLogon();
                            try {
                                app.getConnectionProperties().setLoginCredentials(new LoginCredentials(USERNAME, PASSWORD));
                                app.registerApplication(3600);   
                            catch (Exception e)
                                Log.e("SMP101","Cannot register " + e.getMessage());
                        } else {
                            app.startConnection(TIMEOUT);
                        Log.i("SMP101","Application REGISTERED");
                        if (!SMP101DB.isSynchronized("default")) {
                            Log.i("SMP101","Starting Initial Sync");
                            SMP101DB.disableChangeLog();
                            SMP101DB.synchronize(); // Initial Synchronize
                            SynchronizationGroup sg = SMP101DB.getSynchronizationGroup("default");
                            sg.setEnableSIS(true);
                            sg.save();
                            SMP101DB.synchronize();
                            Log.i("SMP101","Initial Sync COMPLETED");
                        SMP101DB.enableChangeLog();
                    catch (Exception e)
                        e.printStackTrace();
                    finally
                        initializationDone = true;
                    SMP101SampleActivity.this.runOnUiThread(new Runnable()
                        @Override
                        public void run()
                            adapter = new CustomerListAdapter(SMP101SampleActivity.this);
                            ListView listView = (ListView) findViewById(R.id.listView1);
                            listView.setAdapter(adapter);
                            listView.setOnItemClickListener(new OnItemClickListener()
                                @Override
                                public void onItemClick(AdapterView<?> a, View v, int position, long id)
                                    Intent intent = new Intent(SMP101SampleActivity.this, DetailActivity.class);
                                    intent.putExtra("sk", adapter.getSK(position));
                                    SMP101SampleActivity.this.startActivityForResult(intent, REQUEST_DETAIL);
            }).start();

  • C# SendKeys press only single process continuous

    Hello All,
    I try to make a application in c# its send a key press in a single process but its continuous. Bt i face a problem  when i use timer and use sendkeys.send() then that key send all process in windows which is active. i try in different way in sendkeys.send
    wait  with sleep thread but its  doing single time.
    Is it possible that i send key press continuous a process if its running background in c#.
    here is my code wht i work.
    [DllImport("user32.dll")]
    static extern bool SetForegroundWindow(IntPtr hWnd);
    [DllImport("user32.dll")]
    static extern IntPtr GetForegroundWindow();
    [DllImport("User32.DLL")]
    static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
    public const int SW_RESTORE = 9;
    private void startbt_Click(object sender, EventArgs e)
    try
    attktim.Enabled = true;
    // int interval = int.Parse(textBox2.Text);
    // timer1.Interval = interval * 1000;
    Process[] processes = Process.GetProcesses();
    Process[] localByName = Process.GetProcessesByName("notepad");
    Process p = Process.GetProcessesByName("notepad").FirstOrDefault();
    IntPtr Handle = FindWindow(null, "Untitled - Notepad");
    //foreach (Process process in localByName)
    if (p != null && attkchk.Checked==true)
    //Process game1 = localByName[0];
    //IntPtr D = game1.MainWindowHandle;
    //SetForegroundWindow(D);
    attktim.Enabled = true;
    int interval = int.Parse(attktxt.Text);
    attktim.Interval = interval * 1000;
    catch
    attktim.Enabled = false;
    MessageBox.Show("No input ....", "Damu");
    Process p = new Process();
    p.StartInfo.FileName = "notepad.exe";
    p.Start();
    Thread.Sleep(1000);
    SendKeys.SendWait("some text");
    SendKeys.SendWait("A");
    IntPtr dialogHandle = GetForegroundWindow();
    System.Diagnostics.Trace.WriteLine("notepad handle: " + p.MainWindowHandle);
    System.Diagnostics.Trace.WriteLine("dialog handle: " + dialogHandle);
    Thread.Sleep(5000);
    SetForegroundWindow(p.MainWindowHandle);
    ShowWindow(dialogHandle, SW_RESTORE);
    Thread.Sleep(1000);
    SendKeys.SendWait("n");
    private void attktim_Tick(object sender, EventArgs e)
    SendKeys.Send("{`}");
    //SendKeys.SendWait("{2}");
    //Thread.Sleep(1000);
    //SendKeys.SendWait("{2}");
    Thanks for help

    try this:>
    [DllImport("User32.dll")]
    public static extern int SendMessage(IntPtr hWnd, uint msg, int wparam, int lparam);
    and you can read the links below,mybe assis you:>
    http://tiku.io/questions/1672700/c-sharp-sendkeys-sendwait-to-a-dialog-of-another-process-notepad-exe
    http://www.c-sharpcorner.com/UploadFile/40e97e/send-keys-to-application-programmatically-using-C-Sharp/
    Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

  • Error in EHPI Tool in EHP4 upgrade process

    Hello All,
    I have ECC dual stack server at EHP3 and i am upgrading it to EHP4 via EHPI Tool.
    In EHPI wizard "Configuration" step for ABAP is done properly but in J2EE it is stuck with an error "An error has occurred during the execution of the PREPARE_JSPM_QUEUE phase.
    The stack XML D:\SID_Upgrade_Data\SMSDXML_SID_20091217105348.343.xml is not supported by this EHP installer."
    I have seen the log file of EHPi it says.
    "The stack XML D:\SID_Upgrade_Data\SMSDXML_SID_20091217105348.343.xml is not supported by this EHP installer."
    At the time of creation of Stack configuration xml file i have selected all the SCA from solutiion manager, but i cant understand why J2EE is not accepting  the xml that is properly identified by ABAP?
    What can be the reson for this.
    Pls help.
    Thanks and regards.
    Vinit

    Hello All,
    Now i am in "Downtime" phase of EHPI tool The ABAP Phase is Waiting and in MAIN_NEWBAS/GETSYNC_MODPROF_STARTED Phase.
    The J2EE status is Running and it says Phase DEPLOY_ONLINE_DEPL is running ...
    Although there is no log wriiting since last 15 Hrs. The last log that i came to know says.
    ABAP Log(SAPehpiConsole.log).
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Starting of UPDATE CMOD in batch (job RSMODACU)
    working ...
    >> 2009/12/29 22:07:07  END OF PHASE   MAIN_NEWBAS/JOB_RSMODACU
    >> 2009/12/29 22:07:07  START OF PHASE MAIN_NEWBAS/DBCLEAN_UPG
    >> 2009/12/29 22:07:13  END OF PHASE   MAIN_NEWBAS/DBCLEAN_UPG
    >> 2009/12/29 22:07:13  START OF PHASE MAIN_NEWBAS/EXEC_SMON
    >> 2009/12/29 22:07:16  END OF PHASE   MAIN_NEWBAS/EXEC_SMON
    >> 2009/12/29 22:07:16  START OF PHASE MAIN_NEWBAS/STOPSAP_DUAL
    Stopping system ...
    >> 2009/12/29 22:07:29  END OF PHASE   MAIN_NEWBAS/STOPSAP_DUAL
    >> 2009/12/29 22:07:29  START OF PHASE MAIN_NEWBAS/GETSYNC_MODPROF_STARTED
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    JAVA LOG(Dailog Log)
    Java Enhancement Package Installation
    </font>
    <p>When reporting problems to SAP Support, attach the trouble ticket file <b>D:\EHPI\java\log\TroubleTicket_03.txt</b> to your message.<br>
    </html>.
    Dec 29, 2009 4:22:23 PM [Info]:                                               com.sap.sdt.ucp.dialog.Dialog.process(Dialog.java:264) [Thread[main,5,main]]: Dialog PhaseErrorMessage variable handler has been updated.
    Dec 29, 2009 4:22:23 PM [Info]:                                               com.sap.sdt.ucp.dialog.Dialog.process(Dialog.java:214) [Thread[main,5,main]]: Waiting for input in dialog ActionErrorDialog type Composite.
    Dec 29, 2009 4:22:31 PM [Info]:                                               com.sap.sdt.ucp.dialog.Dialog.process(Dialog.java:233) [Thread[main,5,main]]: Processing input in dialog ActionErrorDialog type Composite.
    Dec 29, 2009 4:22:31 PM [Info]:  com.sap.sdt.util.dialog.ExclusiveSelectionDialog.updateVariables(ExclusiveSelectionDialog.java:339) [Thread[main,5,main]]: In dialog ActionErrorOption the value of variable repeat labeled Repeat phase from point of failure has been set to value of variable true.
    Dec 29, 2009 4:22:31 PM [Info]:  com.sap.sdt.util.dialog.ExclusiveSelectionDialog.updateVariables(ExclusiveSelectionDialog.java:339) [Thread[main,5,main]]: In dialog ActionErrorOption the value of variable ignore labeled Ignore error and go to next phase (requires password) has been set to value of variable false.
    Dec 29, 2009 4:22:31 PM [Info]:  com.sap.sdt.util.dialog.ExclusiveSelectionDialog.updateVariables(ExclusiveSelectionDialog.java:339) [Thread[main,5,main]]: In dialog ActionErrorOption the value of variable jump labeled Jump to another phase (requires password) has been set to value of variable false.
    Dec 29, 2009 4:22:31 PM [Info]:  com.sap.sdt.util.dialog.ExclusiveSelectionDialog.updateVariables(ExclusiveSelectionDialog.java:339) [Thread[main,5,main]]: In dialog ActionErrorOption the value of variable exit labeled Exit program has been set to value of variable false.
    Dec 29, 2009 4:22:31 PM [Info]: com.sap.sdt.util.dialog.NavigationButtonGroupDialog.updateVariables(NavigationButtonGroupDialog.java:342) [Thread[main,5,main]]: In dialog Buttons the value of variable BUTTON labeled #Continue has been set to value of variable Continue.
    Dec 29, 2009 4:22:31 PM [Info]: com.sap.sdt.util.dialog.NavigationButtonGroupDialog.updateVariables(NavigationButtonGroupDialog.java:346) [Thread[main,5,main]]: Dialog Buttons has been confirmed.
    Dec 29, 2009 4:22:31 PM [Info]:                        com.sap.sdt.util.dialog.CompositeDialog.isConfirmed(CompositeDialog.java:281) [Thread[main,5,main]]: Dialog ActionErrorDialog has been confirmed.
    Dec 29, 2009 4:22:31 PM [Info]:                                com.sap.sdt.util.dialog.InfoDialog.updateHandler(InfoDialog.java:116) [Thread[main,5,main]]: Dialog type InfoText with dialog name Info displays dialog text <html>
        An error has occurred during the execution of the <i>DEPLOY_ONLINE_DEPL</i> phase.<br>
        <div style="background-color: #dde8ef"><font face="Helvetica, Arial">
        Error while executing DeploymentManager phase with action deploySlot. Check the log files for the specified action.
    Could not execute deployment of stack file D:\HRC_Upgrade_Data\SMSDXML_HRC_20091222112753.484.xml.
    The deployment of the queue failed.
    Deployment of queue sapjup-queue completed with error Cannot stop J2EE instance, SCS instance or OS services.
    Cannot stop OS services, SCS instance and J2EE instance.
    Cannot stop instance HRC 10.
    Could not stop instance 10.
    JSPM version is 7.01.5.1.3. Current JSPM log directory is S:\usr\sap\HRC\DVEBMGS10\j2ee\JSPM\log\log_2009_12_29_14_57_26.
    <br>
        </font></div>
        <p>You may now do one of the following:
        <ul>
          <li><i>Repeat phase from point of failure.</i> After you have corrected the error, you can repeat the phase from the exact point where the error occurred.
          <li><i>Ignore error and go to next phase.</i> You must obtain a password from SAP Support to use this option.
          <li><i>Jump to another phase.</i> You can choose the phase you want to jump to from a list of all phases that belong to the current module. You must obtain a password from SAP Support to use this option. 
          <li><i>Exit program.</i>
        </ul>
        </html>.
    Dec 29, 2009 4:22:31 PM [Info]:                                com.sap.sdt.util.dialog.InfoDialog.updateHandler(InfoDialog.java:116) [Thread[main,5,main]]: Dialog type InfoText with dialog name Info displays dialog text What do you want to do?.
    Dec 29, 2009 4:22:31 PM [Info]: 
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Thanks and Regards
    Vinit

  • JWindow as message box

    I am programming in Java1.1.8 using Visual Age 3.0. I am trying to show a JWindow to alert the user that a query is running. Here's my problem:"
    If I run the method as is, it blows up on the pn.loadTable line. The JWindow shows up fine, is painted, and looks to be working ok. If I run the Wait dialog from a thread outside this method, the JWindow comes up not paointed, but the table loads with the query results. I am using a multiColumnListbox for my table. Any suggestions on how to solve this problem are greatly appreciated. Thanks, jlav
    public void prodtree_TreeSelectionEvents() {
         Runnable t = new Runnable() {
              public void run() {
                   try {
                        WaitWindow wd = new WaitWindow();
                        wd.show();
                        thread.sleep(100);
                        DefaultMutableTreeNode dm = (DefaultMutableTreeNode) ivjProdtree.getLastSelectedPathComponent();
                        ProductNode pn = (ProductNode) dm.getUserObject();
                        wd.repaint();
                        System.out.println("before table load");
                        pn.loadTable(ivjprodtable, conn);
                        System.out.println("after table load");
                        ivjJTextField2.setText("0");
                        ivjJSplitPane1.setDividerLocation(0);
                        getAfterQuery();
                        wd.dispose();
                   } catch (Exception e) {
                        e.printStackTrace();
         Thread thread = new Thread(t);
         thread.start();
         return;
    }

    hard 2 know whats going on here. However, this
    sequence of events is questionable.
    I just cant tell what your GUI thread is doing, and if
    you are freeing it so it candisplay properly your
    window after you set it visible.
    Is your window modal at all?Thanks dnoyeB for answering. I am fairly new to Java and this is bugging me. The GUI is a physical compositoinn of a JWindow in a class called WaitWindow. On the init of the main applet (MkdTrx) I am building a tree for selecting product by dept, sub dept, commodity, and class. When the user expands the tree and clicks on a commmodity for instance, the WaitWindow displays the message while the database search is taking place. When the multiColumnListobx is loaded, the JWindow disposes. My frustration is that this works about half the time, the other half the applet blows up after the JWindow is displayed. Thanks again for your help. I'm not sure if you need more code, please let me know.
    jlav143

  • Photoshop crashes while displaying welcome screen

    We have developed a plug in for Photoshop. Once we have installed the same on target system, this customized welcome screen appears when we open photoshop. Now an attempt to close photoshop 'with the welcome screen still open results in a crash'. This welcome screen is a modal dialog, run on a thread.
    I am not very comfortable with the idea of running this modal dialog on a thread. But, it has been implemented this way. I feel this is where things are going wrong.
    Any tips or suggestions as to what can be wrong, or where i need to be looking to debug the same.
    I have tried to debug the same, but in vain.
    thanks in adavnce

    If you want a welcome screen you should make an automation plug-in that responds to first idle. You can probably get away with using a thread for your dialog. Make sure the thread does not communicate with the Photoshop. Have the thread talk to the main plug-in thread, the PluginMain routine that Photoshop called, if you need to use Photoshop call backs.

  • JFileChooser hangs sometimes

    Hi,
    When I open a JFileChooser save dialog the EDT thread hangs indefinitely. From the stack trace I can see that it is waiting indefinitely when it tries to check if a file is a link or not. This happens only sometimes.The default selected directory(My Documents) does not contain any links or shortcuts.
    Following is the stack trace of AWT-EventQueue thread:
    "AWT-EventQueue-2" prio=6 tid=0x039c9400 nid=0x1210 waiting on condition [0x0400e000..0x0400fb94]
    java.lang.Thread.State: WAITING (parking)
         at sun.misc.Unsafe.park(Native Method)
         - parking to wait for <0x0ae38cd0> (a java.util.concurrent.FutureTask$Sync)
         at java.util.concurrent.locks.LockSupport.park(Unknown Source)
         at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source)
         at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(Unknown Source)
         at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(Unknown Source)
         at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
         at java.util.concurrent.FutureTask.get(Unknown Source)
         at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Unknown Source)
         at sun.awt.shell.Win32ShellFolder2.hasAttribute(Unknown Source)
         at sun.awt.shell.Win32ShellFolder2.isLink(Unknown Source)
         - locked <0x0ae38b00> (a sun.awt.shell.Win32ShellFolder2)
         at javax.swing.filechooser.FileSystemView.isFileSystem(Unknown Source)
         at javax.swing.filechooser.FileSystemView.getSystemDisplayName(Unknown Source)
         at javax.swing.plaf.basic.BasicFileChooserUI$BasicFileView.getName(Unknown Source)
         at javax.swing.JFileChooser.getName(Unknown Source)
         at sun.swing.FilePane$FileRenderer.getListCellRendererComponent(Unknown Source)
         at javax.swing.plaf.basic.BasicListUI.updateLayoutState(Unknown Source)
         at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(Unknown Source)
         at javax.swing.plaf.basic.BasicListUI.getPreferredSize(Unknown Source)
         at javax.swing.JComponent.getPreferredSize(Unknown Source)
         at javax.swing.ScrollPaneLayout.layoutContainer(Unknown Source)
         at java.awt.Container.layout(Unknown Source)
         at java.awt.Container.doLayout(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validateTree(Unknown Source)
         at java.awt.Container.validate(Unknown Source)
         - locked <0x0914e040> (a java.awt.Component$AWTTreeLock)
         at java.awt.Dialog.conditionalShow(Unknown Source)
         - locked <0x0914e040> (a java.awt.Component$AWTTreeLock)
         at java.awt.Dialog.show(Unknown Source)
         at javax.swing.JFileChooser.showDialog(Unknown Source)
         at javax.swing.JFileChooser.showSaveDialog(Unknown Source)
         at com.text.SaveApp.launchExportDialog(ActionManager.java:1356)
         at com.text.SaveApp.actionPerformed(ActionManager.java:608)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.AbstractButton.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    "Basic L&F File Loading Thread" prio=6 tid=0x03413800 nid=0x1438 waiting on condition [0x0503f000..0x0503fd94]
    java.lang.Thread.State: WAITING (parking)
         at sun.misc.Unsafe.park(Native Method)
         - parking to wait for <0x0ae389c0> (a java.util.concurrent.FutureTask$Sync)
         at java.util.concurrent.locks.LockSupport.park(Unknown Source)
         at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source)
         at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(Unknown Source)
         at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(Unknown Source)
         at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
         at java.util.concurrent.FutureTask.get(Unknown Source)
         at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Unknown Source)
         at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run0(Unknown Source)
         at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run(Unknown Source)
    "Swing-Shell" daemon prio=6 tid=0x03b8e800 nid=0x7e4 waiting for monitor entry [0x0437f000..0x0437fb14]
    java.lang.Thread.State: BLOCKED (on object monitor)
         at sun.awt.shell.Win32ShellFolder2.isFileSystem(Unknown Source)
         - waiting to lock <0x0ae38b00> (a sun.awt.shell.Win32ShellFolder2)
         at sun.awt.shell.Win32ShellFolder2.equals(Unknown Source)
         at java.util.AbstractList.equals(Unknown Source)
         at java.util.Vector.equals(Unknown Source)
         - locked <0x0ae38b90> (a java.util.Vector)
         at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread$1.call(Unknown Source)
         at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread$1.call(Unknown Source)
         at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
         at java.util.concurrent.FutureTask.run(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Let me know if any one has faced similar problems.

    "AWT-EventQueue-2"
    - locked <0x0ae38b00> (a sun.awt.shell.Win32ShellFolder2)
    "Swing-Shell"
    - waiting to lock <0x0ae38b00> (a sun.awt.shell.Win32ShellFolder2)
    That's definitely a symptom of the problem. AWT-EventQueue-2 has not released that lock because it is:
    - parking to wait for <0x0ae38cd0> (a java.util.concurrent.FutureTask$Sync)
    Can you find that object "0x0ae38cd0" somewhere else in the thread dump? It might be revealing to see who has ahold of it and why they haven't released it yet.

  • Com.sybase.persistence.SynchronizeException: com.ianywhere.ultralitejni12.implementation.JniException: UltraLiteJ Error[-1305]: MobiLink communication error -- code: 86, parameter: 404, system code: 0Details:

    Hi,
    I am trying to fetch data from SMP 2.3 Server through SMP 2.3 SDK. i have followed all steps which have been mentioned in SYBASE INFOCENTER for Native Android Platfom. i am getting the following error
    com.sybase.persistence.SynchronizeException: com.ianywhere.ultralitejni12.implementation.JniException: UltraLiteJ Error[-1305]: MobiLink communication error -- code: 86, parameter: 404, system code: 0Details:
    if anybody has dea about this error. please respond

    Hi viru,
    No, i am not connecting via relay server. i am connecting to organisation's  SMP Cloud Server. We used the same RFC for creating MBO for iOS application and it worked.
    This is my code:
    import java.util.Hashtable;
    import SampleTest.SampleTestDB;
    import android.app.Activity;
    import android.app.ProgressDialog;
    import android.content.Intent;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.Menu;
    import android.view.View;
    import android.widget.AdapterView;
    import android.widget.AdapterView.OnItemClickListener;
    import android.widget.Button;
    import android.widget.ListView;
    import android.widget.Toast;
    import com.sybase.collections.GenericList;
    import com.sybase.collections.StringList;
    import com.sybase.collections.StringProperties;
    import com.sybase.mobile.Application;
    import com.sybase.mobile.ApplicationCallback;
    import com.sybase.mobile.ConnectionProperties;
    import com.sybase.mobile.ConnectionStatus;
    import com.sybase.mobile.RegistrationStatus;
    import com.sybase.persistence.DefaultCallbackHandler;
    import com.sybase.persistence.LoginCredentials;
    import com.sybase.persistence.SynchronizationAction;
    import com.sybase.persistence.SynchronizationContext;
    import com.sybase.persistence.SynchronizationGroup;
    import com.sybase.persistence.SynchronizationStatus;
    public class ReadActivity extends Activity {
         private static final int REQUEST_DETAIL = 99;
         private static String USERNAME = "supAdmin";
         private static String PASSWORD = "pass";
         private static String HOST = "cloudsap1.ltisap.com";
         private static int PORT = 5001;
         private static int TIMEOUT = 600;
         private EmployeeAdapter adapter;
         private static volatile boolean initializationDone = false;
      ListView ltList;
      Button btnNext;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_read);
      initializeApplication();
    protected void onActivityResult(int requestCode, int resultCode, Intent data)
            if (requestCode == REQUEST_DETAIL)
                if (resultCode == RESULT_OK)
                    ReadActivity.this.adapter.refreshUI(true);
       private void initializeApplication()
        final ProgressDialog dialog = new ProgressDialog(this);
        dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        dialog.setTitle("on boarding ...");
        dialog.setMessage("Please wait while download initial data...");
        dialog.setIndeterminate(false);
        dialog.setProgress(100);
        dialog.setCancelable(true);
        dialog.show();
        new Thread()
            @Override
            public void run()
                try
                    int count = 0;
                    while (!initializationDone)
                        dialog.setProgress(++count);
                        Thread.sleep(100);
                        if (count == 100)
                            count = 0;
                    dialog.cancel();
                catch (Exception e)
                    dialog.cancel();
        }.start();
        Application app = Application.getInstance();
        app.setApplicationIdentifier("SampleTest");//== important!!!!!!!!!!!!!!!!!
        app.setApplicationContext(getApplicationContext());
        new Thread(new Runnable()
            public void run()
                try
                    Application app = Application.getInstance();
                    ApplicationCallback appCallback = new MyApplicationCallback();
                    app.setApplicationCallback(appCallback);
                    SampleTestDB.registerCallbackHandler(new CustomerDBCallback());
                    SampleTestDB.setApplication(app);
                    SampleTestDB.getSynchronizationProfile().setServerName(HOST); // Convenience only
                    ConnectionProperties connProps = app.getConnectionProperties();
                    LoginCredentials loginCredentials = new LoginCredentials(USERNAME, PASSWORD);
                    connProps.setLoginCredentials(loginCredentials);
                    connProps.setServerName(HOST);
                    connProps.setPortNumber(PORT);
                    if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED)
                     try {
                      app.registerApplication(TIMEOUT);
                     catch (Exception e)
                      Log.e("Emp101","Cannot register " + e.getMessage());
                    else
                        app.startConnection(TIMEOUT);
                    Log.i("Emp101","Application REGISTERED");
                    if (!SampleTestDB.isSynchronized("default"))//
                     Log.i("Emp101","Starting Initial Sync");
                        SampleTestDB.disableChangeLog();
                        SampleTestDB.synchronize(); // AFTER  THIS STATEMENT IT IS GIVING THAT ERROR
                        SynchronizationGroup sg = SampleTestDB.getSynchronizationGroup("default");
                        sg.setEnableSIS(true);
                        sg.save();
                      //  SampleTestDB.subscribe();
                        Log.i("Emp101","Subscribe");
                        SampleTestDB.synchronize();
                        Log.i("Emp101","Initial Sync COMPLETED");
                    SampleTestDB.enableChangeLog();
                catch (Exception e)
                    e.printStackTrace();
                finally
                    initializationDone = true;
                ReadActivity.this.runOnUiThread(new Runnable()
                    public void run()
                     btnNext = (Button) findViewById(R.id.btn_create);
                        adapter = new EmployeeAdapter(ReadActivity.this);
                      ltList = (ListView) findViewById(R.id.lvRead);
                      ltList.setAdapter(adapter);
        }).start();
       // Start of ApplicationCallback
       class MyApplicationCallback implements ApplicationCallback
          public void onApplicationSettingsChanged(StringList nameList)
            Log.i("Emp101","Application Settings Changed: "+ nameList);
          public void onConnectionStatusChanged(int connectionStatus, int errorCode, String errorMessage)
                 switch (connectionStatus)
                     case ConnectionStatus.CONNECTED:
                      System.out.println("Device is Connected");
                      Log.i("ERROR1", "Device is Connected");
                         break;
                     case ConnectionStatus.CONNECTING:
                      System.out.println("Device is Connecting");
                      Log.i("ERROR2", "Device is Connecting");
                         break;
                     case ConnectionStatus.CONNECTION_ERROR:
                      System.out.println("Connection Error: " + errorMessage);
                      Log.i("ERROR3", errorMessage);
                         break;
                     case ConnectionStatus.DISCONNECTED:
                      System.out.println("Device is Disconnected");
                      Log.i("ERROR4", "Device is Disconnected");
                         break;
                     case ConnectionStatus.DISCONNECTING:
                      System.out.println("Device is Disconnecting");
                      Log.i("ERROR5", "Device is Disconnecting");
                         break;
          public void onRegistrationStatusChanged(int registrationStatus, int errorCode, String errorMessage)
                 switch (registrationStatus)
                     case RegistrationStatus.REGISTERED:
                      System.out.println("Device is REGISTERED");
                      Log.i("ERROR6", "Device is REGISTERED");
                         break;
                     case RegistrationStatus.REGISTERING:
                      System.out.println("Device is REGISTERING");
                      Log.i("ERROR7", "Device is REGISTERING");
                         break;
                     case RegistrationStatus.REGISTRATION_ERROR:
                      System.out.println("Registration Error: " + errorMessage);
                      Log.i("ERROR8", errorMessage);
                         break;
                     case RegistrationStatus.UNREGISTERED:
                      System.out.println("Device is UNREGISTERED");
                      Log.i("ERROR9", "Device is UNREGISTERED");
                         break;
                     case RegistrationStatus.UNREGISTERING:
                      System.out.println("Device is UNREGISTERING");
                      Log.i("ERROR10", "Device is UNREGISTERING");
                         break;
          public void onHttpCommunicationError(int errorCode, String errorMessage, StringProperties httpHeaders)
           System.out.println("ERROR - HTTP Communication Error: "+ errorMessage);
          public void onDeviceConditionChanged(int condition)
           System.out.println("Device Condition Status: "+ condition);
       public void onCustomizationBundleDownloadComplete(String arg0,
         int arg1, String arg2) {
        // TODO Auto-generated method stub
       public int onPushNotification(Hashtable arg0) {
        // TODO Auto-generated method stub
        return 0;
       //....End of ApplicationCallback
        private class CustomerDBCallback extends DefaultCallbackHandler
             @Override
             public int onSynchronize(GenericList<SynchronizationGroup> groups, SynchronizationContext context)
                 if (context.getStatus() == SynchronizationStatus.STARTING)
                     ReadActivity.this.runOnUiThread(new Runnable()
                         public void run()
                             Toast.makeText(ReadActivity.this, "Synchronizing ... ", Toast.LENGTH_LONG).show();
                 else if (context.getStatus() == SynchronizationStatus.FINISHING || context.getStatus() == SynchronizationStatus.ASYNC_REPLAY_UPLOADED)
                  ReadActivity.this.runOnUiThread(new Runnable()
                         public void run()
                             Toast.makeText(ReadActivity.this, "Synchronize done", Toast.LENGTH_SHORT).show();
                     if (ReadActivity.this.adapter != null)
                      ReadActivity.this.adapter.refreshUI(false);
                 return SynchronizationAction.CONTINUE;
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.read, menu);
      return true;

Maybe you are looking for