0

I'm developing an Android card game app and using smartfox client API in my project. When a user is playing game, smartfox server push responses to the client by invoking callbacks from back end and we need to manipulate app UI within these callbacks.

Now we need to manage threading in these callbacks so that it does not block UI thread as well as all UI updates happens only in UI thread.

We implemented Activity.runOnUiThread(Runnable) where ever we need to update UI. However this solutions doesn't seems to be much efficient. Sometime it works sometime not.

Please share if you do have a better mechanism to handle this kind of situation.

Terry
  • 989
  • 8
  • 29

1 Answers1

0

Try with below portion of the code:

 runOnUiThread(new Runnable() {
            @Override
            public void run() {
                //Do Your Task Here
            }
        });
Pratik Dasa
  • 7,439
  • 4
  • 30
  • 44
  • Thanks @pratt. I already implemented runOnUiThread. However some time it updates UI, sometime it skips. I need a more efficient mechanism that update UI with 100% surety. – Neeraj Kumar Dec 30 '14 at 07:12