android - Is onLoadFinished() asynchronous (background thread)? -
i looking @ using loader manager populate expandablelistview in drawerlayout. cannot find anywhere in documentation if callback function onloadfinished() running on ui thread or on background thread. on background thread?
if have called init()
ui thread, onloaderfinished()
called on ui thread. in cases when call background example asynctaskloader
thread notified outcome thread init loader.
...but still can following:
@override public void onloadfinished(loader<string> arg0, string arg1) { runnable populate = new runnable(){ @override public void run() { //your code } }; if (looper.getmainlooper().getthread() == thread.currentthread()) { //on ui thread populate.run(); }else{ this.runonuithread(populate); //or use handler run runnable } }
:)
Comments
Post a Comment