public Loader<Cursor> onCreateLoader(int id, Bundle args) {
// Now create and return a CursorLoader that will take care of
// creating a Cursor for the data being displayed.
if(id == LOADER_ID_HISTORY) {
return new CursorLoader(this, ActivityDiaryContract.Diary.CONTENT_URI,
PROJECTION, SELECTION, null, null);
}else{
return new CursorLoader(HistoryActivity.this,
ActivityDiaryContract.DiaryImage.CONTENT_URI,
new String[] {ActivityDiaryContract.DiaryImage._ID,
ActivityDiaryContract.DiaryImage.URI},
ActivityDiaryContract.DiaryImage.DIARY_ID + "=? AND "
+ ActivityDiaryContract.DiaryImage._DELETED + "=0",
new String[] {Long.toString(args.getLong("DiaryID"))},
null);
}
}
java类android.content.CursorLoader的实例源码
HistoryActivity.java 文件源码
项目:ActivityDiary
阅读 38
收藏 0
点赞 0
评论 0
LoginActivity.java 文件源码
项目:GitHub
阅读 86
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
DummyLoginActivity.java 文件源码
项目:GSB-2017-Android
阅读 37
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
LoginActivity.java 文件源码
项目:NewsApp
阅读 41
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
LoginActivity.java 文件源码
项目:19porn
阅读 33
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
LoginActivity.java 文件源码
项目:FlashCards
阅读 37
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
AppLoginActivity.java 文件源码
项目:Chore-Manager-App
阅读 34
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
FileMgr.java 文件源码
项目:labtablet
阅读 39
收藏 0
点赞 0
评论 0
@SuppressLint("NewApi")
public static String getRealPathFromURI_API11to18(Context context, Uri contentUri) {
String[] proj = { MediaStore.Images.Media.DATA };
String result = null;
CursorLoader cursorLoader = new CursorLoader(
context,
contentUri, proj, null, null, null);
Cursor cursor = cursorLoader.loadInBackground();
if(cursor != null){
int column_index =
cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
result = cursor.getString(column_index);
}
return result;
}
LoginActivity.java 文件源码
项目:atlas
阅读 32
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
LoginActivity.java 文件源码
项目:FastAndroid
阅读 35
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
CatalogActivity.java 文件源码
项目:pets
阅读 33
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
String[] projection = {
PetEntry._ID,
PetEntry.COLUMN_NAME,
PetEntry.COLUMN_BREED
};
return new CursorLoader(
this,
PetEntry.CONTENT_URI,
projection,
null,
null,
null);
}
EditorActivity.java 文件源码
项目:pets
阅读 40
收藏 0
点赞 0
评论 0
/**
*
* @param id
* @param args
* @return
*/
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
String[] projection = {
PetEntry._ID,
PetEntry.COLUMN_NAME,
PetEntry.COLUMN_BREED,
PetEntry.COLUMN_GENDER,
PetEntry.COLUMN_WEIGHT
};
return new CursorLoader(
this,
uriCurrentPet,
projection,
null,
null,
null);
}
LoginActivity.java 文件源码
项目:changApp
阅读 32
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
LoginActivity.java 文件源码
项目:maklib
阅读 38
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
RegisterActivity.java 文件源码
项目:Book-Tea_Project
阅读 114
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
LoginActivity.java 文件源码
项目:Paathshala
阅读 45
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
SignUp.java 文件源码
项目:Paathshala
阅读 36
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
LoginActivity.java 文件源码
项目:ShotsNewsApp
阅读 37
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
ContactsLoaderCallback.java 文件源码
项目:KTools
阅读 70
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
//指定获取_id和display_name两列数据,display_name即为姓名
String[] projection = new String[]{
ContactsContract.Contacts._ID,
ContactsContract.Contacts.DISPLAY_NAME
};
CursorLoader loader = new CursorLoader(
context,
ContactsContract.Contacts.CONTENT_URI,
projection,
null,
null,
null
);
return loader;
}
LoginActivity.java 文件源码
项目:study-buddy
阅读 62
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
SessionFeedbackModelTest.java 文件源码
项目:iosched-reader
阅读 32
收藏 0
点赞 0
评论 0
@Test
public void createCursorLoader_SessionQuery_Success() {
// Given a mock cursor loader set up for a session query
int sessionsLoaderId = SessionFeedbackModel.SessionFeedbackQueryEnum.SESSION.getId();
CursorLoader mockCursorLoaderSession = mock(CursorLoader.class);
SessionFeedbackModel spyModel = spy(
new SessionFeedbackModel(mMockUri, mMockContext, mMockFeedbackHelper));
doReturn(mockCursorLoaderSession).when(spyModel).getCursorLoaderInstance(
any(Context.class), any(Uri.class), any(String[].class), any(String.class),
any(String[].class), any(String.class));
// When ran with the session query
CursorLoader createdCursorLoader1 =
(CursorLoader) spyModel.createCursorLoader(sessionsLoaderId, mMockUri, null);
// Then the returned cursor loader is the same as the mock one
assertThat(createdCursorLoader1, sameInstance(mockCursorLoaderSession));
}
SessionDetailModelTest.java 文件源码
项目:iosched-reader
阅读 33
收藏 0
点赞 0
评论 0
@Test
public void createCursorLoader_SpeakersQuery_ReturnsCursor() {
// Given a mock uri and mock cursor loader
SessionDetailModel spyModel = spy(
new SessionDetailModel(mMockUri, mMockContext, mMockSessionsHelper));
doReturn(mMockUri).when(spyModel).getSpeakersDirUri(any(String.class));
doReturn(mMockCursorLoader).when(spyModel).getCursorLoaderInstance(
any(Context.class), any(Uri.class), any(String[].class), any(String.class),
any(String[].class), any(String.class));
// When ran with mock uri and speakers query loader id
CursorLoader createdCursorLoader =
(CursorLoader) spyModel.createCursorLoader(
SessionDetailModel.SessionDetailQueryEnum.SPEAKERS.getId(),
mMockUri, null);
// Then the returned cursor loader is the mock cursor loader
assertThat(createdCursorLoader, sameInstance(mMockCursorLoader));
}
SessionDetailModelTest.java 文件源码
项目:iosched-reader
阅读 33
收藏 0
点赞 0
评论 0
@Test
public void createCursorLoader_FeedbackQuery_ReturnsCursor() {
// Given a mock uri and mock cursor loader
SessionDetailModel spyModel = spy(
new SessionDetailModel(mMockUri, mMockContext, mMockSessionsHelper));
doReturn(mMockUri).when(spyModel).getFeedbackUri(any(String.class));
doReturn(mMockCursorLoader).when(spyModel).getCursorLoaderInstance(
any(Context.class), any(Uri.class), any(String[].class), any(String.class),
any(String[].class), any(String.class));
// When ran with mock uri and feedback query loader id
CursorLoader createdCursorLoader =
(CursorLoader) spyModel.createCursorLoader(
SessionDetailModel.SessionDetailQueryEnum.FEEDBACK.getId(),
mMockUri, null);
// Then the returned cursor loader is the mock cursor loader
assertThat(createdCursorLoader, sameInstance(mMockCursorLoader));
}
VideoLibraryModelTest.java 文件源码
项目:iosched-reader
阅读 40
收藏 0
点赞 0
评论 0
@Test
public void createCursorLoader_FilteredVideosQuery_Success() {
// Given a mock cursor loader set up for a video query
int videosLoaderId = VideoLibraryModel.VideoLibraryQueryEnum.VIDEOS.getId();
when(mMockBundle.containsKey(VideoLibraryModel.KEY_TOPIC)).thenReturn(true);
when(mMockBundle.containsKey(VideoLibraryModel.KEY_YEAR)).thenReturn(true);
when(mMockBundle.getString(VideoLibraryModel.KEY_TOPIC)).thenReturn("Android");
when(mMockBundle.getInt(VideoLibraryModel.KEY_YEAR)).thenReturn(2012);
// When ran with the video query
CursorLoader createdCursorLoader =
(CursorLoader) mSpyModel.createCursorLoader(videosLoaderId, Uri.EMPTY, mMockBundle);
// Then the returned cursor loader is the same as the mock one
assertThat(createdCursorLoader, sameInstance(mMockCursorLoader));
}
FileHelper.java 文件源码
项目:localcloud_fe
阅读 41
收藏 0
点赞 0
评论 0
@SuppressLint("NewApi")
public static String getRealPathFromURI_API11to18(Context context, Uri contentUri) {
String[] proj = { MediaStore.Images.Media.DATA };
String result = null;
try {
CursorLoader cursorLoader = new CursorLoader(context, contentUri, proj, null, null, null);
Cursor cursor = cursorLoader.loadInBackground();
if (cursor != null) {
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
result = cursor.getString(column_index);
}
} catch (Exception e) {
result = null;
}
return result;
}
LoginActivity.java 文件源码
项目:AndroidApp-Deploy
阅读 34
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
Login.java 文件源码
项目:programming
阅读 80
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
Login_BT_Activity.java 文件源码
项目:dapay
阅读 66
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
LoginActivity.java 文件源码
项目:Shared-Route
阅读 36
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
PayBillActivity.java 文件源码
项目:Shared-Route
阅读 52
收藏 0
点赞 0
评论 0
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}