Java Code Examples for android.database.Cursor.getShort()

The following are Jave code examples for showing how to use getShort() of the android.database.Cursor class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: popomusic   File: VideoBeanDao.java   Source Code and License Vote up 7 votes
@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;
}
 
Example 2
Project: popomusic   File: MusicBeanDao.java   Source Code and License Vote up 6 votes
@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;
}
 
Example 3
Project: LaunchTime   File: DB.java   Source Code and License Vote up 6 votes
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;
}
 
Example 4
Project: LaunchTime   File: DB.java   Source Code and License Vote up 6 votes
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;
    }
 
Example 5
Project: AndroidBackendlessChat   File: BMessageDao.java   Source Code and License Vote up 6 votes
/** @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;
}
 
Example 6
Project: AndroidBackendlessChat   File: BThreadDao.java   Source Code and License Vote up 6 votes
/** @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;
}
 
Example 7
Project: chat-sdk-android-push-firebase   File: BThreadDao.java   Source Code and License Vote up 6 votes
/** @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;
}
 
Example 8
Project: LaunchTime   File: DB.java   Source Code and License Vote up 6 votes
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;
    }
 
Example 9
Project: LaunchTime   File: DB.java   Source Code and License Vote up 6 votes
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;
    }
 
Example 10
Project: GitHub   File: LitePalTestCase.java   Source Code and License Vote up 5 votes
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;
}
 
Example 11
Project: leoapp-sources   File: QRWriteTask.java   Source Code and License Vote up 5 votes
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;
}
 
Example 12
Project: BeautifulGirls   File: GirlDao.java   Source Code and License Vote up 5 votes
@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;
}
 
Example 13
Project: MyPlace   File: RoomDbHelper.java   Source Code and License Vote up 5 votes
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;
}
 
Example 14
Project: AndroidBackendlessChat   File: BUserDao.java   Source Code and License Vote up 5 votes
/** @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;
}
 
Example 15
Project: AndroidPedometer   File: PedometerEntityDao.java   Source Code and License Vote up 5 votes
/** @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;
}
 
Example 16
Project: Shopping_List   File: StatisticDao.java   Source Code and License Vote up 5 votes
@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;
}
 
Example 17
Project: chat-sdk-android-push-firebase   File: BUserDao.java   Source Code and License Vote up 5 votes
/** @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;
}
 
Example 18
Project: GitHub   File: ShortColumnConverter.java   Source Code and License Vote up 4 votes
@Override
public Short getFieldValue(final Cursor cursor, int index) {
    return cursor.isNull(index) ? null : cursor.getShort(index);
}
 
Example 19
Project: financisto1-holo   File: FieldType.java   Source Code and License Vote up 4 votes
@Override
public Object valueFromCursor(Cursor c, int columnIndex) {
	return c.getShort(columnIndex);
}
 
Example 20
Project: KingTV   File: LiveInfoDao.java   Source Code and License Vote up 4 votes
@Override
public LiveInfo readEntity(Cursor cursor, int offset) {
    LiveInfo entity = new LiveInfo( //
        cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // no
        cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // nick
        cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // avatar
        cursor.getInt(offset + 3), // follow
        cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // id
        cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // uid
        cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // title
        cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // category_id
        cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // slug
        cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // intro
        cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // announcement
        cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cover
        cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // play_at
        cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // last_play_at
        cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // view
        cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // status
        cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // priv
        cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // landscape
        cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // position
        cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // weight
        cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // check
        cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // recommend_image
        cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // videoQuality
        cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // category_name
        cursor.getInt(offset + 24), // screen
        cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // start_time
        cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // stream
        cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // thumb
        cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // video
        cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // app_shuffling_image
        cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // categoryId
        cursor.getShort(offset + 31) != 0, // hidden
        cursor.getShort(offset + 32) != 0, // play_status
        cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // icontext
        cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // category_slug
        cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35) // love_conver
    );
    return entity;
}