Back to project page Test-SimpleTwitterClient.
The source code is released under:
This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a co...
If you think the Android project Test-SimpleTwitterClient 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.Twitter_Android.AppActivity; //from ww w . java 2s . c om import android.app.ListActivity; import android.app.LoaderManager; import android.content.Loader; import android.os.Bundle; import android.widget.ListView; import com.example.Twitter_Android.Fragments.Adapters.TimelineAdapter; import com.example.Twitter_Android.Fragments.Adapters.TweetAdapter; import com.example.Twitter_Android.Loaders.MessageLoader; import com.example.Twitter_Android.Logic.DataCache; import com.example.Twitter_Android.Logic.Tweet; import java.util.List; public class MessagesActivity extends ListActivity implements LoaderManager.LoaderCallbacks<List<Tweet>> { private static final String ADAPTER_TAG = "M_A_ADAPTER"; private TimelineAdapter<Tweet> adapter; private final int MESSAGE_LOADER = 123; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); adapter = (TimelineAdapter<Tweet>) DataCache.getInstance().getAdapter(ADAPTER_TAG); if (adapter == null) { getLoaderManager().initLoader(MESSAGE_LOADER, null, this); } } @Override public Loader<List<Tweet>> onCreateLoader(int id, Bundle args) { return new MessageLoader(this, 0, 0); } @Override public void onLoadFinished(Loader<List<Tweet>> loader, List<Tweet> data) { if (loader.getId() == MESSAGE_LOADER) { if (adapter == null) { adapter = new TweetAdapter(this, data, ADAPTER_TAG); ListView lv = getListView(); lv.setAdapter(adapter); } } } @Override public void onLoaderReset(Loader<List<Tweet>> loader) { } }