Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is my Activity still lagging when I run stuff in service and handler.post method?
    primarykey
    data
    text
    <p>I'm confused why is my activity still lagging, I use remote service that has few methods and each has its own work like download stuff, process data, compare stuff, etc... It will run in background and update data at selected intervals and notify user of changes over notify system.</p> <p>The reason why remote service, because I will eventually add a widget, and service needs to stay running even if android kills the activity, so I unbind it on each onPause(). But as far I understand that part doesn't cause my issue.</p> <p>But back to my problem... so my is Activity still lagging when I run stuff in service and handler.post method.</p> <p>here is the code:</p> <pre><code>public class WarnService extends Service { private Bitmap pic; private boolean dataUpToDate; private void loadData(){ //code that downloads new data and sets the dataUpToDate variable } private void updateLayer(Bitmap bt){ //code that updates some stuff if downloaded and local data differ } private IWarnService.Stub WServiceStub = new IWarnService.Stub() { @Override public void refreshData() throws RemoteException { serviceHandler.post(new Runnable() { @Override public void run() { loadData(); if(!dataUpToDate){ updateLayer(pic); } } }); } } } </code></pre> <p>Also I wanted to add progressDialog to be updated in updateLayer(...) through Activity is a listener to this service, but thats not working well. Whats the best way to update progressDialog? Ever listener, handler, intent, or what?</p> <p>So how do I do this correctly?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload