cancel
Showing results for 
Search instead for 
Did you mean: 

Mobilink synchronization with progress bar in UltraliteJ for Android (updating UI during sync)

Former Member
0 Kudos
5,091

Hello, I am currently working on an Android project which requires me to synchronize with a MobiLink database, and have a dialog box with a progress bar simultaneously keep track of the state of the synchronization, which closes out when the sync is finished.

My current attempt implements the use of a class extending the SyncObserver class which updates the progressBar progress whenever the syncProgress() method is called during synchronization, with the progress being set as the number state that the sync is currently at. The issue is, however, that the UI does not seem to update during the sync. When the project is run, the UI shows the initialized dialog box with an empty progress bar, and when the synchronization is occurring nothing appears to update, even though the setProgress() method is being called directly from the syncUpdate() method of the SyncObserver class. After the synchronization is finished, the progressBar jumps to being completed.

I have gotten the progress bar to work using "dummy" data, as in a for loop with an increment and a sleep timer per iteration. Putting the synchronization command in an ASyncTask class only results in the program crashing. It seems to be the case that the Android UI will not "update" while it is running a method or command, leading me to believe that the solution would be either a manual update or refresh method in Android, or there being some sort of variable prohibiting this kind of tracking in the MobiLink synchronize command.

Has anyone run into a similar problem and found a solution, or notice something that I can do to fix this?

Thank you in advance for your response.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Never mind, I found the issue, and how to remedy it. The reason I could not call the synchronize method asynchronously was because I was not creating the connection parameters in the same thread it was synchronizing in. Trying to synchronize in a thread separate from the one you initialized the thread in will throw a warning, then an error. The problem wasn't on Sybase's end, it was on mine. 😄

Answers (0)