編輯:關於Android編程
To perform a query, create the CursorLoader, set up its query, and pass it to the loader framework. From then on, the framework manages everything. It runs the query on a background thread, returns the results to the foreground, and watches for changes to the data associated with the query. http://blog.csdn.net/sergeycao
Pass a CursorLoader to the loader framework in your implementation ofonCreateLoader(). The loader framework calls this method when youcreate a loader by calling initLoader(). You can create aCursorLoader anywhere, but the preferred way is to create it inonCreateLoader(), because this defers creation until the object is actually needed.
Notice that initLoader() will only onCreateLoader() if theCursorLoader doesn't already exist; otherwise, it re-uses the existingCursorLoader. The loader framework tracks CursorLoader instance using theid value passed to initLoader().
Define and Launch the Query
To create a CursorLoader and define its query at the same time, call the constructorCursorLoader(context, uri, projection, selection, selectionArgs, sortOrder). Thecontext and uri arguments are required, but the others are optional. To use the default value for an optional argument, pass innull. The CursorLoader runs the query against theContentProvider identified by uri, just as if you had calledContentResolver.query() with the same arguments.
For example:
public Loader<Cursor> onCreateLoader(int loaderID, Bundle bundle)
{
/*
* Takes action based on the ID of the Loader that's being created
*/
switch (loaderID) {
case URL_LOADER:
/*
* Return a new CursorLoader
*/
return new CursorLoader(
this, // Context
DataProviderContract.IMAGE_URI, // Provider's content URI
PROJECTION, // Columns to return
null, // Return all rows
null, // No search arguments
null); // Default search order
default:
// An invalid id was passed in
return null;
}
}
OKHttp3是如今非常流行的Android網絡請求框架,那麼如何利用Android實現斷點續傳呢,今天寫了個Demo嘗試了一下,感覺還是有點意思准備階段我們會用到OKH
側滑菜單在很多應用中都會見到,最近QQ5.0側滑還玩了點花樣~~對於側滑菜單,一般大家都會自定義ViewGroup,然後隱藏菜單欄,當手指滑動時,通過Scroller或者
一、ViewPageIndicator開源框架的基本用法 我們先得去Github上面下載這個庫,下載地址:https://github.com/JakeWharton/A
Batterystats & Battery Historian Walkthrough Battery Historian Charts Android應用的