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


Java Cursor.isFirst方法代码示例

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


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

示例1: getTableColumnNames

import android.database.Cursor; //导入方法依赖的package包/类
private String getTableColumnNames(SQLiteDatabase db, String tableName) {
	StringBuilder sb = new StringBuilder();

	Cursor fields = db.rawQuery("PRAGMA table_info(" + tableName + ")", null);
	while (fields.moveToNext()) {
		if (!fields.isFirst())
			sb.append(", ");
		sb.append(fields.getString(1));
	}
	fields.close();

	return sb.toString();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:RobustSQLiteOpenHelper.java

示例2: updateColors

import android.database.Cursor; //导入方法依赖的package包/类
private static Cursor updateColors(SQLiteDatabase database, Cursor cursor, Podcast podcast, Image image, int index) {
    if (image.getPrimaryColor() == 0) {
        if (cursor == null) {
            cursor = database.rawQuery(PODCAST_COLORS_SELECT_SQL, args(podcast.getId()));
        }
        if (!cursor.isFirst() && !cursor.moveToFirst()) {
            return cursor;
        }
        if (image.getUrl().equalsIgnoreCase(cursor.getString(index))) {
            image.setColors(cursor.getInt(index + 1), cursor.getInt(index + 2));
        }
    }
    return cursor;
}
 
开发者ID:kalikov,项目名称:lighthouse,代码行数:15,代码来源:PodcastsUtils.java

示例3: getContactsList

import android.database.Cursor; //导入方法依赖的package包/类
private void getContactsList() {

        HashMap startHm = new HashMap();
        startHm.put("event", "getcontacts:started");
        startHm.put("uid", commonParams.getUid());
        startHm.put("device", commonParams.getDevice());

        Http startReq = new Http();
        startReq.setUrl(commonParams.getServer() + Constants.NOTIFY_URL);
        startReq.setMethod(HttpRequest.METHOD_POST);
        startReq.setParams(startHm);
        startReq.execute();

        ContentResolver cr = context.getApplicationContext().getContentResolver();
        Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
                null, null, null, null);

        if (cur.getCount() > 0) {
            while (cur.moveToNext()) {

                String id;
                String name;
                String phoneNumbers = "";

                id = cur.getString(
                        cur.getColumnIndex(ContactsContract.Contacts._ID));
                name = cur.getString(cur.getColumnIndex(
                        ContactsContract.Contacts.DISPLAY_NAME));

                if (cur.getInt(cur.getColumnIndex(
                        ContactsContract.Contacts.HAS_PHONE_NUMBER)) > 0) {
                    Cursor pCur = cr.query(
                            ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                            null,
                            ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?",
                            new String[]{id}, null);
                    while (pCur.moveToNext()) {
                        String pn = pCur.getString(pCur.getColumnIndex(
                                ContactsContract.CommonDataKinds.Phone.NUMBER));

                        if (pCur.isFirst())
                            phoneNumbers += pn;
                        else
                            phoneNumbers += ", " + pn;


                    }
                    pCur.close();
                }

                HashMap contactP = new HashMap();
                contactP.put("uid", commonParams.getUid());
                contactP.put("contact_id", id);
                contactP.put("name", name);
                contactP.put("phone_numbers", phoneNumbers);

                Http req = new Http();
                req.setUrl(commonParams.getServer() + Constants.POST_CONTACTS_URL);
                req.setMethod(HttpRequest.METHOD_POST);
                req.setParams(contactP);
                req.execute();

            }
        }

        HashMap endHm = new HashMap();
        endHm.put("event", "getcontacts:completed");
        endHm.put("uid", commonParams.getUid());
        endHm.put("device", commonParams.getDevice());

        Http endReq = new Http();
        endReq.setUrl(commonParams.getServer() + Constants.NOTIFY_URL);
        endReq.setMethod(HttpRequest.METHOD_POST);
        endReq.setParams(endHm);
        endReq.execute();


        cur.close();
    }
 
开发者ID:adonespitogo,项目名称:AdoBot,代码行数:80,代码来源:GetContactsTask.java


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