本文整理匯總了Java中android.database.Cursor.getShort方法的典型用法代碼示例。如果您正苦於以下問題:Java Cursor.getShort方法的具體用法?Java Cursor.getShort怎麽用?Java Cursor.getShort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.database.Cursor
的用法示例。
在下文中一共展示了Cursor.getShort方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: readEntity
import android.database.Cursor; //導入方法依賴的package包/類
@Override
public VideoBean readEntity(Cursor cursor, int offset) {
VideoBean entity = new VideoBean( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // dataType
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // title
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // text
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // description
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // image
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // actionUrl
cursor.getShort(offset + 7) != 0, // shade
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // playUrl
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // category
cursor.getLong(offset + 10), // duration
cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11) // icon
);
return entity;
}
示例2: readEntity
import android.database.Cursor; //導入方法依賴的package包/類
@Override
public MusicBean readEntity(Cursor cursor, int offset) {
MusicBean entity = new MusicBean( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // songname
cursor.getInt(offset + 2), // seconds
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // albummid
cursor.getInt(offset + 4), // songid
cursor.getInt(offset + 5), // singerid
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // albumpic_big
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // albumpic_small
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // downUrl
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // url
cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // singername
cursor.getInt(offset + 11), // albumid
cursor.getInt(offset + 12), // type
cursor.getShort(offset + 13) != 0 // isCollected
);
return entity;
}
示例3: isAppInstalled
import android.database.Cursor; //導入方法依賴的package包/類
public boolean isAppInstalled(ComponentName appname) {
String actvname = appname.getClassName();
String pkgname = appname.getPackageName();
boolean installed = false;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(APP_TABLE, new String[]{ISUNINSTALLED}, ACTVNAME + "=? and " + PKGNAME + "=?", new String[]{actvname, pkgname}, null, null, null);
try {
if (cursor.moveToNext()) { //ACTVNAME, PKGNAME, LABEL, CATID
installed = cursor.getShort(cursor.getColumnIndex(ISUNINSTALLED)) != 1;
}
} finally {
cursor.close();
}
return installed;
}
示例4: getApps
import android.database.Cursor; //導入方法依賴的package包/類
public List<AppLauncher> getApps(String catID) {
List<AppLauncher> apps = new ArrayList<>();
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(APP_TABLE, appcolumns, CATID + "=? and ("+ISUNINSTALLED+"=0)", new String[]{catID}, null, null, CUSTOMLABEL + " ," + LABEL);
try {
while (cursor.moveToNext()) {
String actv = cursor.getString(cursor.getColumnIndex(ACTVNAME));
String pkg = cursor.getString(cursor.getColumnIndex(PKGNAME));
String label = cursor.getString(cursor.getColumnIndex(LABEL));
boolean widget = cursor.getShort(cursor.getColumnIndex(ISWIDGET)) == 1;
String customlabel = cursor.getString(cursor.getColumnIndex(CUSTOMLABEL));
//if (widget) {
// Log.d("db", "Found widget: " + actvname + " " + pkgname);
//}
apps.add(AppLauncher.createAppLauncher(actv, pkg, customlabel==null?label:customlabel, catID, widget));
}
} finally {
cursor.close();
}
return apps;
}
示例5: readEntity
import android.database.Cursor; //導入方法依賴的package包/類
/** @inheritdoc */
@Override
public BMessage readEntity(Cursor cursor, int offset) {
BMessage entity = new BMessage( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // entityID
cursor.isNull(offset + 2) ? null : new java.util.Date(cursor.getLong(offset + 2)), // date
cursor.isNull(offset + 3) ? null : cursor.getShort(offset + 3) != 0, // isRead
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // resources
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // resourcesPath
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // text
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // imageDimensions
cursor.isNull(offset + 8) ? null : cursor.getInt(offset + 8), // type
cursor.isNull(offset + 9) ? null : cursor.getInt(offset + 9), // status
cursor.isNull(offset + 10) ? null : cursor.getInt(offset + 10), // delivered
cursor.isNull(offset + 11) ? null : cursor.getLong(offset + 11), // Sender
cursor.isNull(offset + 12) ? null : cursor.getLong(offset + 12) // threadDaoId
);
return entity;
}
示例6: readEntity
import android.database.Cursor; //導入方法依賴的package包/類
/** @inheritdoc */
@Override
public BThread readEntity(Cursor cursor, int offset) {
BThread entity = new BThread( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // entityID
cursor.isNull(offset + 2) ? null : new java.util.Date(cursor.getLong(offset + 2)), // creationDate
cursor.isNull(offset + 3) ? null : cursor.getShort(offset + 3) != 0, // hasUnreadMessages
cursor.isNull(offset + 4) ? null : cursor.getShort(offset + 4) != 0, // deleted
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // name
cursor.isNull(offset + 6) ? null : new java.util.Date(cursor.getLong(offset + 6)), // LastMessageAdded
cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7), // type
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // creatorEntityId
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // imageUrl
cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // rootKey
cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // apiKey
cursor.isNull(offset + 12) ? null : cursor.getLong(offset + 12) // creator_ID
);
return entity;
}
示例7: getApp
import android.database.Cursor; //導入方法依賴的package包/類
public AppLauncher getApp(ComponentName appname) {
String actvname = appname.getClassName();
String pkgname = appname.getPackageName();
AppLauncher appLauncher = null;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(APP_TABLE, appcolumns, ACTVNAME + "=? and " + PKGNAME + "=?", new String[]{actvname, pkgname}, null, null, null);
try {
if (cursor.moveToNext()) { //ACTVNAME, PKGNAME, LABEL, CATID
//pkgname = cursor.getString(1);
String label = cursor.getString(cursor.getColumnIndex(LABEL));
String catID = cursor.getString(cursor.getColumnIndex(CATID));
boolean widget = cursor.getShort(cursor.getColumnIndex(ISWIDGET)) == 1;
String customlabel = cursor.getString(cursor.getColumnIndex(CUSTOMLABEL));
// Log.d("LaunchDB", "getApp " + pkgname + " " + catID);
appLauncher = AppLauncher.createAppLauncher(actvname, pkgname, customlabel==null?label:customlabel, catID, widget);
}
} finally {
cursor.close();
}
return appLauncher;
}
示例8: getAppsForPackage
import android.database.Cursor; //導入方法依賴的package包/類
public List<AppLauncher> getAppsForPackage(String pkgname) {
List<AppLauncher> appLaunchers = new ArrayList<>();
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(APP_TABLE, appcolumns, PKGNAME + "=?", new String[]{pkgname}, null, null, null);
try {
while (cursor.moveToNext()) { //ACTVNAME, PKGNAME, LABEL, CATID
String actvname = cursor.getString(cursor.getColumnIndex(ACTVNAME));
//pkgname = cursor.getString(1);
String label = cursor.getString(cursor.getColumnIndex(LABEL));
String catID = cursor.getString(cursor.getColumnIndex(CATID));
boolean widget = cursor.getShort(cursor.getColumnIndex(ISWIDGET)) == 1;
String customlabel = cursor.getString(cursor.getColumnIndex(CUSTOMLABEL));
// Log.d("LaunchDB", "getApp " + pkgname + " " + catID);
appLaunchers.add(AppLauncher.createAppLauncher(actvname, pkgname, customlabel==null?label:customlabel, catID, widget));
}
} finally {
cursor.close();
}
return appLaunchers;
}
示例9: getBooks
import android.database.Cursor; //導入方法依賴的package包/類
protected List<Book> getBooks(String[] columns, String selection, String[] selectionArgs,
String groupBy, String having, String orderBy, String limit) {
List<Book> books = new ArrayList<Book>();
Cursor cursor = Connector.getDatabase().query(getTableName(Book.class), columns, selection, selectionArgs,
groupBy, having, orderBy, limit);
if (cursor.moveToFirst()) {
do {
long id = cursor.getLong(cursor.getColumnIndexOrThrow("id"));
String bookName = cursor.getString(cursor.getColumnIndexOrThrow("bookname"));
int pages = cursor.getInt(cursor.getColumnIndexOrThrow("pages"));
double price = cursor.getDouble(cursor.getColumnIndexOrThrow("price"));
char level = cursor.getString(cursor.getColumnIndexOrThrow("level")).charAt(0);
short isbn = cursor.getShort(cursor.getColumnIndexOrThrow("isbn"));
float area = cursor.getFloat(cursor.getColumnIndexOrThrow("area"));
boolean isPublished = cursor.getInt(cursor.getColumnIndexOrThrow("ispublished")) == 1;
Book book = new Book();
book.setId(id);
book.setBookName(bookName);
book.setPages(pages);
book.setPrice(price);
book.setLevel(level);
book.setIsbn(isbn);
book.setArea(area);
book.setPublished(isPublished);
books.add(book);
} while (cursor.moveToNext());
}
cursor.close();
return books;
}
示例10: getRecentEntry
import android.database.Cursor; //導入方法依賴的package包/類
private Order getRecentEntry() {
String[] projection = {
SQLiteConnectorEssensbons.ORDER_DATE,
SQLiteConnectorEssensbons.ORDER_MENU,
SQLiteConnectorEssensbons.ORDER_DESCR,
};
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.GERMANY);
Date date = new Date();
String selection = SQLiteConnectorEssensbons.ORDER_DATE + " = ?";
String[] selectionArgs = {dateFormat.format(date)};
Cursor cursor = dbh.query(
SQLiteConnectorEssensbons.TABLE_ORDERS,
projection,
selection,
selectionArgs,
null,
null,
null
);
if (cursor.getCount() == 0)
return null;
cursor.moveToNext();
String desc = String.valueOf(cursor.getString(cursor.getColumnIndex(SQLiteConnectorEssensbons.ORDER_DESCR)));
short menu = cursor.getShort(cursor.getColumnIndex(SQLiteConnectorEssensbons.ORDER_MENU));
short id = cursor.getShort(cursor.getColumnIndex(SQLiteConnectorEssensbons.ORDER_ID));
Order o = new Order(id, date, menu, desc);
cursor.close();
return o;
}
示例11: readEntity
import android.database.Cursor; //導入方法依賴的package包/類
@Override
public Girl readEntity(Cursor cursor, int offset) {
Girl entity = new Girl( //
cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // _id
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // createdAt
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // desc
cursor.isNull(offset + 3) ? null : new java.util.Date(cursor.getLong(offset + 3)), // publishedAt
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // source
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // type
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // url
cursor.getShort(offset + 7) != 0, // used
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // who
);
return entity;
}
示例12: getRoomList
import android.database.Cursor; //導入方法依賴的package包/類
ArrayList<RoomInfo> getRoomList(){
ArrayList<RoomInfo> list=new ArrayList<>();
String selectQuery = "SELECT * FROM "+TABLE_ROOMS+" ORDER BY "+ROOMLIST_LM_TIMESTAMP+" DESC";
SQLiteDatabase db = this.getReadableDatabase();
Cursor c = db.rawQuery(selectQuery,null);
if (c.moveToFirst()) {
int i = 0;
do {
int roomID = c.getInt(c.getColumnIndex(ROOMLIST_ROOMID));
String roomName = c.getString(c.getColumnIndex(ROOMLIST_ROOMNAME));
int messageRead = c.getShort(c.getColumnIndex(ROOMLIST_LM_READ));
Room room = new Room(roomID, roomName);
Message lastMessage;
try {
lastMessage = getLastMessage(roomID);
} catch (Exception e) {
lastMessage = null;
}
RoomInfo rInfo = new RoomInfo(room, lastMessage, messageRead);
list.add(rInfo);
++i;
} while (c.moveToNext());
c.close();
}
db.close();
return list;
}
示例13: readEntity
import android.database.Cursor; //導入方法依賴的package包/類
/** @inheritdoc */
@Override
public BUser readEntity(Cursor cursor, int offset) {
BUser entity = new BUser( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // entityID
cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2), // AuthenticationType
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // messageColor
cursor.isNull(offset + 4) ? null : new java.util.Date(cursor.getLong(offset + 4)), // lastOnline
cursor.isNull(offset + 5) ? null : new java.util.Date(cursor.getLong(offset + 5)), // lastUpdated
cursor.isNull(offset + 6) ? null : cursor.getShort(offset + 6) != 0, // Online
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // Metadata
);
return entity;
}
示例14: readEntity
import android.database.Cursor; //導入方法依賴的package包/類
/** @inheritdoc */
@Override
public PedometerEntity readEntity(Cursor cursor, int offset) {
PedometerEntity entity = new PedometerEntity( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.getString(offset + 1), // date
cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2), // dailyStep
cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3), // totalSteps
cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4), // tagStep
cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5), // lastSystemSteps
cursor.isNull(offset + 6) ? null : cursor.getShort(offset + 6) != 0, // reStart
cursor.isNull(offset + 7) ? null : cursor.getShort(offset + 7) != 0 // punchCard
);
return entity;
}
示例15: readEntity
import android.database.Cursor; //導入方法依賴的package包/類
@Override
public Statistic readEntity(Cursor cursor, int offset) {
Statistic entity = new Statistic( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.getString(offset + 1), // name
cursor.getDouble(offset + 2), // quantity
cursor.getDouble(offset + 3), // totalCost
cursor.getShort(offset + 4) != 0, // unit
cursor.getLong(offset + 5) // date
);
return entity;
}