Back to project page streaming_project.
The source code is released under:
GNU General Public License
If you think the Android project streaming_project listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.streaming.streaming; //from w w w.j a v a2 s .c o m import android.content.Context; import android.support.v4.content.AsyncTaskLoader; public abstract class DataLoader<D> extends AsyncTaskLoader<D> { private D mData; public DataLoader(Context context) { super(context); } @Override // Delivers data if it is available protected void onStartLoading() { // Check if there is data if (mData != null) { // Deliver the data deliverResult(mData); } else { // Fetch the data // NOTE: forceLoad() is from the superclass AsyncTaskLoader forceLoad(); } } @Override // Stashes away the new data object and, if hte loader is started, calls the superclass // implementation to make the delivery public void deliverResult(D data) { mData = data; if (isStarted()) super.deliverResult(data); } }