当前位置: 首页>>代码示例>>Java>>正文


Java ContentUris.appendId方法代码示例

本文整理汇总了Java中android.content.ContentUris.appendId方法的典型用法代码示例。如果您正苦于以下问题:Java ContentUris.appendId方法的具体用法?Java ContentUris.appendId怎么用?Java ContentUris.appendId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.ContentUris的用法示例。


在下文中一共展示了ContentUris.appendId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: notesIdProperties

import android.content.ContentUris; //导入方法依赖的package包/类
public static Uri notesIdProperties(long id) {
    Uri.Builder builder = AUTHORITY_URI.buildUpon();
    builder = builder.appendPath("notes");
    builder = ContentUris.appendId(builder, id);
    builder = builder.appendPath("properties");
    return builder.build();
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:8,代码来源:ProviderContract.java

示例2: booksIdLinks

import android.content.ContentUris; //导入方法依赖的package包/类
public static Uri booksIdLinks(long id) {
    Uri.Builder builder = AUTHORITY_URI.buildUpon();
    builder = builder.appendPath("books");
    builder = ContentUris.appendId(builder, id);
    builder = builder.appendPath("links");
    return builder.build();
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:8,代码来源:ProviderContract.java

示例3: booksIdSaved

import android.content.ContentUris; //导入方法依赖的package包/类
public static Uri booksIdSaved(long id) {
    Uri.Builder builder = AUTHORITY_URI.buildUpon();
    builder = builder.appendPath("books");
    builder = ContentUris.appendId(builder, id);
    builder = builder.appendPath("saved");
    return builder.build();

}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:9,代码来源:ProviderContract.java

示例4: queryEventInstances

import android.content.ContentUris; //导入方法依赖的package包/类
@Override
protected Cursor queryEventInstances(long startFrom, long startTo,
                                     String[] projection, String selection, String[] selectionArgs,
                                     String sortOrder) {
  Uri.Builder builder = Instances.CONTENT_URI.buildUpon();
  ContentUris.appendId(builder, startFrom);
  ContentUris.appendId(builder, startTo);
  return this.cordova.getActivity().getContentResolver().query(
          builder.build(), projection, selection, selectionArgs, sortOrder);
}
 
开发者ID:disit,项目名称:siiMobilityAppKit,代码行数:11,代码来源:CalendarProviderAccessor.java

示例5: ReadCalendar

import android.content.ContentUris; //导入方法依赖的package包/类
public ArrayList<CalendarEntryDto> ReadCalendar(long timeSpanId) {
    Logger.getInstance().Debug(TAG, "ReadCalendar");

    ArrayList<CalendarEntryDto> entries = new ArrayList<>();
    HashSet<String> calendarIds = new HashSet<>();

    ContentResolver contentResolver = _context.getContentResolver();
    Cursor cursor = contentResolver.query(Uri.parse("content://com.android.calendar/events"), new String[]{"calendar_id", "title", "description", "dtstart", "dtend", "eventLocation"}, null, null, null);
    if (cursor == null) {
        Logger.getInstance().Error(TAG, "Cursor is null!");
        return new ArrayList<>();
    }

    Logger.getInstance().Debug(TAG, String.format(Locale.getDefault(), "Cursor count: %d", cursor.getCount()));

    try {
        if (cursor.getCount() > 0) {
            while (cursor.moveToNext()) {
                String _id = cursor.getString(0);
                calendarIds.add(_id);
            }
        }
    } catch (Exception ex) {
        Logger.getInstance().Error(TAG, "Outer: " + ex.toString());
    } finally {
        cursor.close();
    }

    Logger.getInstance().Debug(TAG, String.format(Locale.getDefault(), "Size of calendarIds is %d", calendarIds.size()));

    for (String id : calendarIds) {
        Logger.getInstance().Debug(TAG, String.format(Locale.getDefault(), "CalendarId: %s", id));

        Uri.Builder builder = Uri.parse("content://com.android.calendar/instances/when").buildUpon();
        long now = new Date().getTime();

        ContentUris.appendId(builder, now - timeSpanId);
        ContentUris.appendId(builder, now + timeSpanId);

        Cursor eventCursor = contentResolver.query(builder.build(),
                new String[]{"title", "begin", "end", "allDay"},
                CalendarContract.Instances.CALENDAR_ID + "=" + id, null, "startDay ASC, startMinute ASC");

        if (eventCursor == null) {
            Logger.getInstance().Error(TAG, "EventCursor is null!");
            continue;
        }

        Logger.getInstance().Debug(TAG, String.format(Locale.getDefault(), "eventCursor count: %d", eventCursor.getCount()));

        if (eventCursor.getCount() > 0) {
            if (eventCursor.moveToFirst()) {
                do {
                    // Properties
                    final String title = eventCursor.getString(0);
                    final Date begin = new Date(eventCursor.getLong(1));
                    final Date end = new Date(eventCursor.getLong(2));
                    final boolean allDay = !eventCursor.getString(3).equals("0");
                    CalendarEntryDto newEntry = new CalendarEntryDto(title, begin, end, allDay);
                    Logger.getInstance().Debug(TAG, String.format(Locale.getDefault(), "Adding new calendar entry %s", newEntry));
                    entries.add(newEntry);
                } while (eventCursor.moveToNext());
            }
        }

        eventCursor.close();
    }

    Logger.getInstance().Debug(TAG, String.format(Locale.getDefault(), "Size of entry list is %d", entries.size()));
    entries.sort(Comparator.comparing(CalendarEntryDto::GetBegin));

    return entries;
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-AndroidApplication,代码行数:74,代码来源:CalendarController.java


注:本文中的android.content.ContentUris.appendId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。