Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in August and this forum will be retired.

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.

asked 25 Oct '11, 13:35

Bytronics1's gravatar image

accept rate: 100%

edited 25 Oct '11, 15:47

Graham%20Hurst's gravatar image

Graham Hurst

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. :D

permanent link

answered 25 Oct '11, 14:40

Bytronics1's gravatar image

accept rate: 100%

edited 25 Oct '11, 14:40

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 25 Oct '11, 13:35

question was seen: 4,855 times

last updated: 25 Oct '11, 15:47