I am currently trying to learn how to use Loaders and am having trouble starting a Loader in my activity.
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
public class ASwitchActivity extends Activity implements
LoaderManager.LoaderCallbacks<SampleLoader.SampleLoaderResult> {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
getLoaderManager().initLoader(0, null, this);
}
public Loader<SampleLoader.SampleLoaderResult> onCreateLoader(int id, Bundle args) {
return new SampleLoader(getBaseContext(), account, "dog");
}
public void onLoadFinished(Loader<SampleLoader.SampleLoaderResult> loader, SampleLoader.SampleLoaderResult out)
{
TextView t=(TextView)findViewById(R.id.testTV);
t.setText("yay");
}
public void onLoaderReset(Loader<SampleLoader.SampleLoaderResult> loader){
}
}
However Eclipse gives an error stating:
The method initLoader(int, Bundle, LoaderManager.LoaderCallbacks) in the type LoaderManager is not applicable for the arguments (int, null, ActivitySwitchActivity)
Can anyone help with where I am going wrong?
ListActivity
? There is no such thing as aFragmentListActivity
that I can drop in as a replacement. – Boynton