Example usage for android.app Activity getContentResolver

List of usage examples for android.app Activity getContentResolver

Introduction

In this page you can find the example usage for android.app Activity getContentResolver.

Prototype

@Override
    public ContentResolver getContentResolver() 

Source Link

Usage

From source file:com.conferenceengineer.android.iosched.ui.ExploreFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    activity.getContentResolver().registerContentObserver(ScheduleContract.Sessions.CONTENT_URI, true,
            mObserver);//from   w w w  .jav a  2s . com
}

From source file:at.flack.MainActivity.java

private static Integer fetchThumbnailId(Activity context, String number) {
    if (number == null || number.length() == 0)
        return null;
    final Uri uri = Uri.withAppendedPath(ContactsContract.CommonDataKinds.Phone.CONTENT_FILTER_URI,
            Uri.encode(number));/*from  w w  w. j a va2s .  c  o m*/
    final Cursor cursor = context.getContentResolver().query(uri, SMSItem.PHOTO_ID_PROJECTION, null, null,
            ContactsContract.Contacts.DISPLAY_NAME + " ASC");

    try {
        Integer thumbnailId = null;
        if (cursor.moveToFirst()) {
            thumbnailId = cursor.getInt(cursor.getColumnIndex(ContactsContract.Contacts.PHOTO_ID));
        }
        return thumbnailId;
    } finally {
        cursor.close();
    }

}

From source file:de.elanev.studip.android.app.frontend.contacts.ContactsGroupsFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    activity.getContentResolver().registerContentObserver(ContactsContract.CONTENT_URI_CONTACT_GROUPS, true,
            mObserver);/* w  w  w.j  av  a  2 s . co  m*/
}

From source file:de.schildbach.wallet.ui.EditTransactionNoteFragment.java

@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = activity;
    this.contentResolver = activity.getContentResolver();
    this.prefs = PreferenceManager.getDefaultSharedPreferences(activity.getApplication());
}

From source file:cc.mintcoin.wallet.ui.EditAddressBookEntryFragment.java

@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = activity;
    this.contentResolver = activity.getContentResolver();
}

From source file:de.elanev.studip.android.app.frontend.courses.CourseScheduleFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    activity.getContentResolver().registerContentObserver(EventsContract.CONTENT_URI, true, mEventsObserver);
}

From source file:de.elanev.studip.android.app.frontend.courses.CourseAttendeesFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    activity.getContentResolver().registerContentObserver(UsersContract.CONTENT_URI, true, mObserver);
}

From source file:de.elanev.studip.android.app.frontend.courses.CourseRecordingsFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    activity.getContentResolver().registerContentObserver(RecordingsContract.CONTENT_URI, true, mObserver);
}

From source file:it.imwatch.nfclottery.dialogs.ClearDBAlertDialog.java

/**
 * Clears the database.//from w ww  . java  2 s.co  m
 */
private void clearDB() {
    final Activity activity = getActivity();
    if (activity == null) {
        Log.e(TAG, "Not attached to Activity: cannot clear DB");
        return;
    }

    ContentResolver cr = activity.getContentResolver();
    cr.delete(NFCMLContent.Geeks.CONTENT_URI, null, null);

    if (activity instanceof MainActivity) {
        final MainActivity mainActivity = (MainActivity) activity;
        mainActivity.showCroutonNao(mainActivity.getString(R.string.info_db_cleared), Style.INFO);
        mainActivity.updateParticipantsCount();
    } else {
        Log.e(TAG, "The parent Activity is not MainActivity! Wat is this I don't even");
        if (DEBUG)
            Log.d(TAG, "Activity class: " + activity.getLocalClassName());
        Toast.makeText(activity, activity.getString(R.string.clear_db_failed_wrong_parent), Toast.LENGTH_SHORT)
                .show();
    }
}

From source file:com.kncwallet.wallet.ui.EditAddressBookEntryFragment.java

@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = activity;
    this.contentResolver = activity.getContentResolver();

}