List of usage examples for android.app Activity runOnUiThread
public final void runOnUiThread(Runnable action)
From source file:net.eledge.android.europeana.search.RecordController.java
public void readRecord(Activity activity, String id) { if (StringUtils.isNotBlank(id)) { if ((record != null) && StringUtils.equals(id, record.about)) { // don't load the same record twice but do notify listeners!; activity.runOnUiThread(new ListenerNotifier<>(listeners.values(), record)); return; }/*from w w w .j a v a 2 s . c o m*/ record = null; currentRecordId = id; currentRecordSelected = false; if (mRecordTask != null) { mRecordTask.cancel(true); } mRecordTask = new RecordTask(activity); mRecordTask.execute(id); } }
From source file:com.androcast.illusion.illusionmod.fragments.ViewPagerFragment.java
public void addFragment(ViewPagerItem item) { if (items.indexOf(item) < 0) { items.add(item);//from ww w . j a va2s .co m adapter.notifyDataSetChanged(); } if (getCount() > 1) { Activity activity; if ((activity = getActivity()) != null) activity.runOnUiThread(new Runnable() { @Override public void run() { if (mTabs != null) mTabs.setIndicatorColor(getResources().getColor(R.color.white)); } }); } }
From source file:ca.ualberta.cmput301.t03.trading.TradeOfferHistoryFragment.java
@Override public void update(Observable observable) { Activity activity = getActivity(); if (activity != null) { activity.runOnUiThread(new Runnable() { @Override/*w w w. j a v a2 s. c om*/ public void run() { adapter.notifyDataSetChanged(); } }); } }
From source file:at.ac.tuwien.detlef.fragments.PodListFragment.java
/** * Updates the displayed list based on the current model contents. Ensures * that UI methods are called on the UI thread. *///from ww w . j a v a2 s .co m private void updatePodcastList() { Activity activity = getActivity(); if (activity == null) { return; } activity.runOnUiThread(new Runnable() { @Override public void run() { adapter.notifyDataSetChanged(); } }); }
From source file:at.ac.tuwien.detlef.fragments.PodListFragment.java
@Override public void onPodcastDeleted(final Podcast podcast) { Log.v(TAG, String.format("onPodcastDeleted: %s", podcast.getTitle())); Activity activity = getActivity(); if (activity == null) { return;// w w w. j a v a2s . co m } activity.runOnUiThread(new Runnable() { @Override public void run() { model.removePodcast(podcast); } }); updatePodcastList(); }
From source file:at.ac.tuwien.detlef.fragments.PodListFragment.java
@Override public void onPodcastAdded(final Podcast podcast) { Log.v(TAG, String.format("onPodcastAdded: %s", podcast.getTitle())); Activity activity = getActivity(); if (activity == null) { return;/*from w ww. j av a 2 s . c o m*/ } activity.runOnUiThread(new Runnable() { @Override public void run() { model.addPodcast(podcast); sortByTitle(); } }); updatePodcastList(); }
From source file:org.messic.android.smartphone.activities.main.fragments.random.RandomFragment.java
private void updateSongs() { android.app.Activity activity = getActivity(); if (activity != null) { activity.runOnUiThread(new Runnable() { @Override/*from ww w.ja v a2 s. co m*/ public void run() { mProgressBar.setVisibility(View.VISIBLE); mAdapter.clear(); Observable<MDMSong> observable = presenter.getRandomSongs(); observable.subscribeOn(Schedulers.io()).onBackpressureBuffer() .observeOn(AndroidSchedulers.mainThread()) .subscribe(randomSongsOnNext, randomSongsOnError, randomSongsOnCompleted); } }); } }
From source file:com.groundupworks.partyphotobooth.fragments.ConfirmationFragment.java
@Override public void onResume() { super.onResume(); // Schedule auto-submission of the fragment. mSubmissionTimer = new Timer(AUTO_SUBMISSION_TIMER_NAME); mSubmissionTimer.schedule(new TimerTask() { @Override/* ww w . ja va 2s. c o m*/ public void run() { // Post submission request to ui thread. final Activity activity = getActivity(); if (activity != null && !activity.isFinishing()) { activity.runOnUiThread(new Runnable() { @Override public void run() { // Call to client. ICallbacks callbacks = getCallbacks(); if (callbacks != null) { callbacks.onSubmit(); // Clear weak reference to prevent possibility of duplicate calls. mCallbacks.clear(); } } }); } } }, mAutoSubmissionTimeout); }
From source file:com.fatelon.partyphotobooth.fragments.ConfirmationFragment.java
@Override public void onResume() { super.onResume(); // Schedule auto-submission of the fragment. mSubmissionTimer = new Timer(AUTO_SUBMISSION_TIMER_NAME); mSubmissionTimer.schedule(new TimerTask() { @Override/*from w ww . j a v a2s . com*/ public void run() { // Post submission request to ui thread. final Activity activity = getActivity(); if (activity != null && !activity.isFinishing()) { activity.runOnUiThread(new Runnable() { @Override public void run() { // Call to client. ICallbacks callbacks = getCallbacks(); if (callbacks != null) { callbacks.onSubmit(); // Clear weak reference to prevent possibility of duplicate calls. mCallbacks.clear(); } } }); } } }, mAutoSubmissionTimeout); }
From source file:ca.ualberta.cmput301.t03.user.FriendsListFragment.java
/** * {@inheritDoc}/*w w w .jav a 2 s . co m*/ */ @Override public void update(Observable observable) { Activity activity = getActivity(); activity.runOnUiThread(new Runnable() { @Override public void run() { mAdapter.notifyDataSetChanged(); } }); }