Setting Up the Loader 设置装载机
来源:互联网 发布:怎样应对大数据时代 编辑:程序博客网 时间:2024/04/29 16:13
You create a CursorLoader
within a loader framework. To set up the framework, you implement theLoaderCallbacks<Cursor>
as part of anActivity
. In addition, to provide compatibility compatible with platform versions starting with Android 1.6, you must extend theActivity
with theFragmentActivity
class. http://blog.csdn.net/sergeycao
Note: A Fragment
is not a prerequisite forCursorLoader
. As a convenience, the support library classFragmentActivity
contains the fragment and the loader frameworks, but they are completely independent of each other.
Before you can use the loader framework, you need to initialize it. To do this, retrieve aLoaderManager
object and call itsinitLoader()
method.
If you do use one or more Fragment
objects in an Activity
, the LoaderManager
you retrieve is available to all of them.
Extend an Activity
To set up an Activity
subclass to contain a CursorLoader
, extend the subclass with must extend FragmentActivity
, which provides the loader framework, and implement theLoaderCallbacks<Cursor>
interface, which specifies method signatures that the loader framework uses to interact with theActivity
.
For example:
public class DisplayActivity extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor>
Retrieve a LoaderManager
To get an instance LoaderManager
for use in your Activity
, call FragmentActivity.getSupportLoaderManager()
at the beginning of theonCreate()
method. For example:
private LoaderManager mLoaderManager;public void onCreate() {...mLoaderManager = this.getSupportLoaderManager();
Initialize the Loader Framework
Once you have the LoaderManager
object, initialize it by callinginitLoader()
. For example:
// CursorLoader instance identifierpublic static final int URL_LOADER = 0;...// Initializes the CursorLoadergetSupportLoaderManager().initLoader(URL_LOADER, null, this);
- Setting Up the Loader 设置装载机
- setting up the centos7
- (转)3.3设置状态栏(Setting Up the Status Bar)
- Setting Up the Search Interface 设置搜索界面
- Setting Up the Search Interface(设置搜索接口)
- 设置应用栏(Setting Up the App Bar)
- Setting up the Direct3D 10 Device
- Setting Up the Action Bar --1.1.1
- Setting up the Wicket response to the JavaScript call
- Adding the Action Bar - Setting Up the Action Bar
- (Visual Studio)Part 2: Setting up the IDESetting up the IDE for the debugger
- 《Hadoop The Definitive Guide》ch09 Setting Up a Hadoop Cluster
- Setting up the C++ Analyzer for MSVC++ 6.0
- (Visual Studio)Part 4: Setting up Code for the Debugger
- Tutorial: Setting up the Python/Jython Environment for Burp Suite
- android-Adding Search Functionality,Setting Up the Search Interface
- Neural Networks Part 1:Setting up the Architecture
- CS231n Neural Networks Part 1: Setting up the Architecture
- VTP协议及其配置
- Connecting with Wi-Fi Direct 与Wi-Fi直接连接
- Android&IOS开源项目整理(记得就更新)
- Using Wi-Fi Direct for Service Discovery 直接使用Wi-Fi服务发现
- CF:43A. Football
- Setting Up the Loader 设置装载机
- Defining and Launching the Query 定义和启动查询
- NYOJ 252 01串 dp
- Silverlight4:Devexpress Report
- 将输入流转换为字符串
- 已知有个rand7()的函数,返回1到7随机自然数,让利用这个rand7()构造rand10() 随机1~10。
- Handling the Results 处理结果
- vxworks中sd卡文件系统
- CSS中的度量单位 px em ex pt pc in mm cm