Example usage for android.app Activity runOnUiThread

List of usage examples for android.app Activity runOnUiThread

Introduction

In this page you can find the example usage for android.app Activity runOnUiThread.

Prototype

public final void runOnUiThread(Runnable action) 

Source Link

Document

Runs the specified action on the UI thread.

Usage

From source file:org.deviceconnect.android.manager.setting.DevicePluginInfoFragment.java

/**
 * ??RunnableUI???.//ww  w  .j a va 2 s .  c  o m
 * @param r ?Runnable
 */
private void runOnUiThread(final Runnable r) {
    Activity activity = getActivity();
    if (activity != null) {
        activity.runOnUiThread(r);
    }
}

From source file:org.onebusaway.android.map.StopsRequest.java

private void refresh() {
    // First we need to check to see if the current request we have can handle this.
    // Otherwise, we need to restart the loader with the new request.
    if (mCallback != null) {
        Activity a = mCallback.getActivity();
        if (a != null) {
            a.runOnUiThread(new Runnable() {
                @Override//from w w w  . j  av  a 2  s .c o m
                public void run() {
                    StopsLoader loader = getLoader();
                    if (loader != null) {
                        StopsRequest req = new StopsRequest(mCallback.getMapView());
                        loader.update(req);
                    }
                }
            });
        }
    }
}

From source file:org.messic.android.smartphone.activities.main.fragments.queue.PlayQueueFragment.java

private void updateSongs() {
    Activity activity = getActivity();
    if (activity != null) {
        activity.runOnUiThread(new Runnable() {
            @Override// w  w w .j a v a 2s.  c  om
            public void run() {
                mProgressBar.setVisibility(View.VISIBLE);
                mAdapter.clear();
                Observable<MDMSong> observable = presenter.getQueueSongs();
                observable.subscribeOn(Schedulers.io()).onBackpressureBuffer()
                        .observeOn(AndroidSchedulers.mainThread())
                        .subscribe(playqueueSongsOnNext, playqueueSongsOnError, playqueueSongsOnCompleted);
            }
        });

    }

}

From source file:com.example.echoprint.AudioFingerprinter.java

private void didFinishListening() {
    if (listener == null)
        return;//from   w  w w.j  a  va  2 s  .c  o  m

    if (listener instanceof Activity) {
        Activity activity = (Activity) listener;
        activity.runOnUiThread(new Runnable() {
            public void run() {
                listener.didFinishListening();
            }
        });
    } else
        listener.didFinishListening();
}

From source file:com.example.echoprint.AudioFingerprinter.java

private void didFinishListeningPass() {
    if (listener == null)
        return;//from w ww.  j  a  va 2 s  .c o  m

    if (listener instanceof Activity) {
        Activity activity = (Activity) listener;
        activity.runOnUiThread(new Runnable() {
            public void run() {
                listener.didFinishListeningPass();
            }
        });
    } else
        listener.didFinishListeningPass();
}

From source file:com.example.echoprint.AudioFingerprinter.java

private void willStartListening() {
    if (listener == null)
        return;/*from   w  ww  . ja  v  a  2  s. com*/

    if (listener instanceof Activity) {
        Activity activity = (Activity) listener;
        activity.runOnUiThread(new Runnable() {
            public void run() {
                listener.willStartListening();
            }
        });
    } else
        listener.willStartListening();
}

From source file:com.example.echoprint.AudioFingerprinter.java

private void willStartListeningPass() {
    if (listener == null)
        return;/*from w  w w .ja va 2s . co m*/

    if (listener instanceof Activity) {
        Activity activity = (Activity) listener;
        activity.runOnUiThread(new Runnable() {
            public void run() {
                listener.willStartListeningPass();
            }
        });
    } else
        listener.willStartListeningPass();
}

From source file:com.example.echoprint.AudioFingerprinter.java

private void didGenerateFingerprintCode(final String code) {
    if (listener == null)
        return;/*from  w  w  w  . ja v  a2  s  .c om*/

    if (listener instanceof Activity) {
        Activity activity = (Activity) listener;
        activity.runOnUiThread(new Runnable() {
            public void run() {
                listener.didGenerateFingerprintCode(code);
            }
        });
    } else
        listener.didGenerateFingerprintCode(code);
}

From source file:com.example.echoprint.AudioFingerprinter.java

private void didFindMatchForCode(final Hashtable<String, String> table, final String code) {
    if (listener == null)
        return;//from   w w  w. j  a  v  a  2 s . c  om

    if (listener instanceof Activity) {
        Activity activity = (Activity) listener;
        activity.runOnUiThread(new Runnable() {
            public void run() {
                listener.didFindMatchForCode(table, code);
            }
        });
    } else
        listener.didFindMatchForCode(table, code);
}

From source file:com.example.echoprint.AudioFingerprinter.java

private void didNotFindMatchForCode(final String code) {
    if (listener == null)
        return;//from   w  w w. j  ava2s.c o  m

    if (listener instanceof Activity) {
        Activity activity = (Activity) listener;
        activity.runOnUiThread(new Runnable() {
            public void run() {
                listener.didNotFindMatchForCode(code);
            }
        });
    } else
        listener.didNotFindMatchForCode(code);
}