當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractCursor類代碼示例

本文整理匯總了Java中android.database.AbstractCursor的典型用法代碼示例。如果您正苦於以下問題:Java AbstractCursor類的具體用法?Java AbstractCursor怎麽用?Java AbstractCursor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AbstractCursor類屬於android.database包,在下文中一共展示了AbstractCursor類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: query

import android.database.AbstractCursor; //導入依賴的package包/類
@SuppressLint("NewApi")
@Nullable
@Override
public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
    String path = uri.getEncodedPath();
    if (!path.startsWith("/font/")
            || selectionArgs == null ||  selectionArgs[0] == null) {
        return null;
    }

    String name = path.substring("/font/".length());
    String[] w = selectionArgs[0].split(",");
    int[] weight = new int[w.length];
    for (int i = 0; i < w.length; i++) {
        weight[i] = Integer.parseInt(w[i]);
    }

    FontFamily[] families = FontManager.getFontFamily(getContext(), name, weight);

    Bundle bundle = new Bundle();
    bundle.putParcelableArray("data", families);

    AbstractCursor cursor = new SimpleCursor();
    cursor.setExtras(bundle);
    return cursor;
}
 
開發者ID:RikkaApps,項目名稱:FontProvider,代碼行數:27,代碼來源:FontProvider.java

示例2: type

import android.database.AbstractCursor; //導入依賴的package包/類
public static SubjectFactory<AbstractCursor_Subject, AbstractCursor> type() {
  return new SubjectFactory<AbstractCursor_Subject, AbstractCursor>() {
    @Override
    public AbstractCursor_Subject getSubject(FailureStrategy fs, AbstractCursor that) {
      return new AbstractCursor_Subject(fs, that);
    }
  };
}
 
開發者ID:pkware,項目名稱:truth-android,代碼行數:9,代碼來源:AbstractCursor_Subject.java

示例3: getInstanceUncheckedLocked

import android.database.AbstractCursor; //導入依賴的package包/類
private Loader getInstanceUncheckedLocked(String documentId)
        throws FileNotFoundException {
    try {
        final ParsedDocumentId id = ParsedDocumentId.fromDocumentId(documentId, mIdDelimiter);
        if (mArchives.get(id.mArchiveId) != null) {
            return mArchives.get(id.mArchiveId);
        }

        final Cursor cursor = mProvider.queryDocument(id.mArchiveId, new String[]
                { Document.COLUMN_MIME_TYPE, COLUMN_LOCAL_FILE_PATH });
        cursor.moveToFirst();
        final String mimeType = cursor.getString(cursor.getColumnIndex(
                Document.COLUMN_MIME_TYPE));
        Preconditions.checkArgument(isSupportedArchiveType(mimeType),
                "Unsupported archive type.");
        final int columnIndex = cursor.getColumnIndex(COLUMN_LOCAL_FILE_PATH);
        final String localFilePath = columnIndex != -1 ? cursor.getString(columnIndex) : null;
        final File localFile = localFilePath != null ? new File(localFilePath) : null;

        final Uri notificationUri = ((AbstractCursor)cursor).getNotificationUri();
        final Loader loader = new Loader(mProvider, localFile, id, mIdDelimiter,
                notificationUri);

        // Remove the instance from mArchives collection once the archive file changes.
        if (notificationUri != null) {
            final LruCache<String, Loader> finalArchives = mArchives;
            mProvider.getContext().getContentResolver().registerContentObserver(notificationUri,
                    false,
                    new ContentObserver(null) {
                        @Override
                        public void onChange(boolean selfChange, Uri uri) {
                            synchronized (mArchives) {
                                final Loader currentLoader = mArchives.get(id.mArchiveId);
                                if (currentLoader == loader) {
                                    mArchives.remove(id.mArchiveId);
                                }
                            }
                        }
                    });
        }

        mArchives.put(id.mArchiveId, loader);
        return loader;
    } catch (IOException e) {
        // DocumentsProvider doesn't use IOException. For consistency convert it to
        // IllegalStateException.
        throw new IllegalStateException(e);
    }
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:50,代碼來源:DocumentArchiveHelper.java

示例4: AbstractCursor_Subject

import android.database.AbstractCursor; //導入依賴的package包/類
protected AbstractCursor_Subject(FailureStrategy failureStrategy, AbstractCursor subject) {
  super(failureStrategy, subject);
}
 
開發者ID:pkware,項目名稱:truth-android,代碼行數:4,代碼來源:AbstractCursor_Subject.java

示例5: AbstractCursor_Assert

import android.database.AbstractCursor; //導入依賴的package包/類
public AbstractCursor_Assert(AbstractCursor actual) {
  super(actual, AbstractCursor_Assert.class);
}
 
開發者ID:square,項目名稱:assertj-android,代碼行數:4,代碼來源:AbstractCursor_Assert.java


注:本文中的android.database.AbstractCursor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。