Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid facebook wait for AsyncFacebookRunner to finish?
    primarykey
    data
    text
    <p>In my application, I have a ProgressDialog showing while the app do something:</p> <pre><code>mProgressDialog = ProgressDialog.show( ((FriendListActivity) ctx).getParent(), "Please wait...", "Getting data...", true); updateDisplay(true); </code></pre> <p>In updateDisplay method, it do someting like this:</p> <pre><code>items = new ArrayList&lt;FriendInfo&gt;(); fa = new FriendListAdapter(ctx, R.layout.friendlist_item, items); setListAdapter(fa); Thread t = new Thread() { public void run() { getFriendList(); //This is where the problem occured initFriendList(); handler.post(new Runnable() { public void run() { mProgressDialog.dismiss(); fa.notifyDataSetChanged(); }; }); } }; t.start(); </code></pre> <p>In <code>getFriendList()</code>, I make a call to get Facebook user's information:</p> <pre><code>AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner( facebook); mAsyncRunner.request("me/friends&amp;fields=name,picture", new FriendsRequestListener((FriendListActivity) ctx, currentuser)); </code></pre> <p>After that, the user's information will be saved in my database. And the <code>initFriendList();</code> method (below <code>getFriendList()</code>) will use that data to init the view. </p> <p>The problem is I want initFriendList() wait until getFriendList() finish to get data. But in <code>getFriendList()</code>, I use AsyncFacebookRunner, so initFriendList() will run immediately. How can I make initFriendList() wait for AsyncFacebookRunner to finish before it run.</p>
    singulars
    1. This table or related slice is empty.
    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