本文整理汇总了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();
}
示例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;
}
示例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();
}