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


Java Cursor.getDouble方法代码示例

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


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

示例1: findByTitle

import android.database.Cursor; //导入方法依赖的package包/类
public CartProducts findByTitle(String title){
    String query = "Select * FROM " + TABLE_PRODUCT + " WHERE " + PRODUCT_TITLE + " =  \"" + title + "\"";
    SQLiteDatabase db = this.getReadableDatabase();
    Cursor c = db.rawQuery(query, null);
    CartProducts product ;

    if (c.moveToFirst()) {
        c.moveToFirst();
        product = new CartProducts(c.getString(1),c.getString(2),c.getDouble(4),c.getString(5),c.getDouble(6),c.getInt(7));
      c.close();
    } else {
        product = null;
    }
    db.close();
    return product;
}
 
开发者ID:techstar-cloud,项目名称:techstar-shop,代码行数:17,代码来源:CartTable.java

示例2: loadFromCursor

import android.database.Cursor; //导入方法依赖的package包/类
private void loadFromCursor(Cursor cursor) {
    id = cursor.getInt(INDEX_ID);
    caption = cursor.getString(INDEX_CAPTION);
    mimeType = cursor.getString(INDEX_MIME_TYPE);
    latitude = cursor.getDouble(INDEX_LATITUDE);
    longitude = cursor.getDouble(INDEX_LONGITUDE);
    dateTakenInMs = cursor.getLong(INDEX_DATE_TAKEN);
    dateAddedInSec = cursor.getLong(INDEX_DATE_ADDED);
    dateModifiedInSec = cursor.getLong(INDEX_DATE_MODIFIED);
    filePath = cursor.getString(INDEX_DATA);
    rotation = cursor.getInt(INDEX_ORIENTATION);
    bucketId = cursor.getInt(INDEX_BUCKET_ID);
    fileSize = cursor.getLong(INDEX_SIZE);
    width = cursor.getInt(INDEX_WIDTH);
    height = cursor.getInt(INDEX_HEIGHT);
}
 
开发者ID:mayurkaul,项目名称:medialibrary,代码行数:17,代码来源:LocalImage.java

示例3: fetchTrack

import android.database.Cursor; //导入方法依赖的package包/类
/**
 * Retrieve a track from the database given its starting and ending index.
 *
 * @param fromId the id of the first checkpoint
 * @param toId the id of the last checkpoint
 * @return the track
 */
private Track fetchTrack(long fromId, long toId) {
    String selection = CHECKPOINTS_COLS[0] + " >= " + fromId + " AND " + CHECKPOINTS_COLS[0] + " <= " + toId;
    Cursor result = db.query(CHECKPOINTS_TABLE_NAME, CHECKPOINTS_COLS, selection, null, null, null, null);
    Track track = new Track();
    if (result.getCount() > 0) {
        while (result.moveToNext()) {
            Double latitude = result.getDouble(1);
            Double longitude = result.getDouble(2);

            CheckPoint checkpoint = new CheckPoint(latitude, longitude);
            track.add(checkpoint);
        }
    }
    result.close();
    return track;
}
 
开发者ID:IrrilevantHappyLlamas,项目名称:Runnest,代码行数:24,代码来源:DBHelper.java

示例4: getFuelQtyForCons

import android.database.Cursor; //导入方法依赖的package包/类
@Nullable
public Double getFuelQtyForCons(long carID, BigDecimal prevIndex, Double currIndex) {
    Double retVal = null;
    String selectSql;
    Cursor selectCursor;
    selectSql = " SELECT SUM( " + COL_NAME_REFUEL__QUANTITY + ") " + " FROM " + TABLE_NAME_REFUEL + " WHERE 1 = 1 " + WHERE_CONDITION_ISACTIVE + " AND "
            + COL_NAME_REFUEL__INDEX + " > " + prevIndex + " AND " + COL_NAME_REFUEL__INDEX + " <= " + currIndex + " AND " + COL_NAME_REFUEL__CAR_ID
            + " = " + carID;

    selectCursor = execSelectSql(selectSql, null);
    if (selectCursor.moveToFirst()) {
        retVal = selectCursor.getDouble(0);
    }
    selectCursor.close();
    return retVal;
}
 
开发者ID:mkeresztes,项目名称:AndiCar,代码行数:17,代码来源:DBAdapter.java

示例5: getPlaceFromCursor

import android.database.Cursor; //导入方法依赖的package包/类
private Place getPlaceFromCursor(Cursor cursor) {
    int id = cursor.getInt(cursor.getColumnIndex(RemindyContract.PlaceTable._ID));
    String alias = cursor.getString(cursor.getColumnIndex(RemindyContract.PlaceTable.COLUMN_NAME_ALIAS.getName()));
    String address = cursor.getString(cursor.getColumnIndex(RemindyContract.PlaceTable.COLUMN_NAME_ADDRESS.getName()));
    double latitude = cursor.getDouble(cursor.getColumnIndex(RemindyContract.PlaceTable.COLUMN_NAME_LATITUDE.getName()));
    double longitude = cursor.getDouble(cursor.getColumnIndex(RemindyContract.PlaceTable.COLUMN_NAME_LONGITUDE.getName()));
    int radius = cursor.getInt(cursor.getColumnIndex(RemindyContract.PlaceTable.COLUMN_NAME_RADIUS.getName()));
    boolean isOneOff = Boolean.valueOf(cursor.getString(cursor.getColumnIndex(RemindyContract.PlaceTable.COLUMN_NAME_IS_ONE_OFF.getName())));

    return new Place(id, alias, address, latitude, longitude, radius, isOneOff);
}
 
开发者ID:abicelis,项目名称:Remindy,代码行数:12,代码来源:RemindyDAO.java

示例6: readData

import android.database.Cursor; //导入方法依赖的package包/类
public ArrayList<CartProducts> readData(){

        SQLiteDatabase db = this.getReadableDatabase();
        ArrayList<CartProducts> data = new ArrayList<CartProducts>();

        String[] projection = {
                PRODUCT_ID,
                PRODUCT_TITLE,
                PRODUCT_DESCRIPTION,
                PRODUCT_COST,
                PRODUCT_IMAGE,
                PRODUCT_TOTAL_COST,
                PRODUCT_TOTAL_ORDER
        };

        String sortOrder =
                PRODUCT_TITLE + " ASC";

        Cursor c = db.query(
                TABLE_PRODUCT,
                projection,
                null,
                null,
                null,
                null,
                sortOrder
        );

        while(c.moveToNext()){
            CartProducts product = new CartProducts(c.getString(1),c.getString(2),c.getDouble(3),c.getString(4),c.getDouble(5),c.getInt(6));
          data.add(product);
        };
        c.close();
        db.close();
        return data;
    }
 
开发者ID:techstar-cloud,项目名称:techstar-shop,代码行数:37,代码来源:CartTable.java

示例7: cursorToMemory

import android.database.Cursor; //导入方法依赖的package包/类
private Memory cursorToMemory(Cursor cursor){
    Memory memory = new Memory();
    memory.id = cursor.getLong(0);
    memory.city = cursor.getString(1);
    memory.country = cursor.getString(2);
    memory.latitude = cursor.getDouble(3);
    memory.longitude = cursor.getDouble(4);
    memory.notes = cursor.getString(5);
    return memory;
}
 
开发者ID:PacktPublishing,项目名称:Android-Wear-Projects,代码行数:11,代码来源:MemoriesDataSource.java

示例8: 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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:LitePalTestCase.java

示例9: readEntity

import android.database.Cursor; //导入方法依赖的package包/类
@Override
public UsedProduct readEntity(Cursor cursor, int offset) {
    UsedProduct entity = new UsedProduct( //
        cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
        cursor.getDouble(offset + 1), // quantity
        cursor.getShort(offset + 2) != 0, // unit
        cursor.getShort(offset + 3) != 0, // isPurchased
        cursor.getLong(offset + 4), // date
        cursor.isNull(offset + 5) ? null : cursor.getLong(offset + 5), // productId
        cursor.getLong(offset + 6) // shoppingListId
    );
    return entity;
}
 
开发者ID:Lidchanin,项目名称:Shopping_List,代码行数:14,代码来源:UsedProductDao.java

示例10: getAllRedPolygons

import android.database.Cursor; //导入方法依赖的package包/类
public ArrayList<LatLng> getAllRedPolygons(String type) {
    ArrayList<LatLng> redPolygons = new ArrayList<>();

    Cursor res = getAllLocations("Temp Polygon Red");
    while(res.moveToNext()) {
        LatLng latLng = new LatLng(res.getDouble(2), res.getDouble(3));
        redPolygons.add(latLng);
    }
    return redPolygons;
}
 
开发者ID:kav0rka,项目名称:VennTracker,代码行数:11,代码来源:DatabaseHelper.java

示例11: getDraftsByUid

import android.database.Cursor; //导入方法依赖的package包/类
/**
 * 根据用户Id(uid)获取草稿
 *
 * @param uid 用户Id
 * @return 该用户的所有草稿,没有找到返回null
 */
public List<Draft> getDraftsByUid(String uid) {
    SQLiteDatabase db = this.dbHelper.getReadableDatabase();
    Cursor cursor = db.query(DBInfo.Table.DRAFT_TB_NAME, columns,
            Draft.UID + "=?", new String[]{uid}, null, null, null);

    List<Draft> draftList = null;
    if (cursor != null) {
        int count = cursor.getCount();
        if (count > 0) {
            draftList = new ArrayList<>(count);
            Draft draft = null;
            while (cursor.moveToNext()) {
                int id = cursor.getInt(cursor.getColumnIndex(Draft.ID));
                String content = cursor.getString(cursor.getColumnIndex(Draft.CONTENT));
                List<Photo> photoList = Draft.string2PhotoList(cursor.getString(cursor.getColumnIndex(Draft.PHOTO_LIST)));
                double latitude = cursor.getDouble(cursor.getColumnIndex(Draft.LATITUDE));
                double longitude = cursor.getDouble(cursor.getColumnIndex(Draft.LONGITUDE));
                boolean isEnableGeo = cursor.getInt(cursor.getColumnIndex(Draft.IS_ENABLE_GEO)) == 1;
                boolean isLocation = cursor.getInt(cursor.getColumnIndex(Draft.IS_LOCATION)) == 1;
                String addrStr = cursor.getString(cursor.getColumnIndex(Draft.ADDR_STR));
                int menuId = cursor.getInt(cursor.getColumnIndex(Draft.MENU_ID));
                String groupId = cursor.getString(cursor.getColumnIndex(Draft.GROUP_ID));
                String groupName = cursor.getString(cursor.getColumnIndex(Draft.GROUP_NAME));

                draft = new Draft(id, uid, content, photoList, latitude, longitude, isEnableGeo,
                        isLocation, addrStr, menuId, groupId, groupName);
                draftList.add(draft);
            }
        }
        cursor.close();
    }
    db.close();
    return draftList;
}
 
开发者ID:liying2008,项目名称:Simpler,代码行数:41,代码来源:DraftServices.java

示例12: FromCursor

import android.database.Cursor; //导入方法依赖的package包/类
private void FromCursor(Cursor c) {
    id = c.getLong(c.getColumnIndex("_id"));
    Latitude = c.getDouble(c.getColumnIndex("Lat"));
    Longitude = c.getDouble(c.getColumnIndex("Lon"));
    Alt = c.getInt(c.getColumnIndex("Alt"));
    Speed = c.getDouble(c.getColumnIndex("Speed"));
    HError = c.getDouble(c.getColumnIndex("Error"));
    try {
        TimeStamp = getUTCFormatter().parse(c.getString(c.getColumnIndex("TimeStamp")));
    } catch (ParseException ignored) {
    }
    TZOffset = c.getInt(c.getColumnIndex("TZOffset"));
    Comment = c.getString(c.getColumnIndex("Comment"));
}
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:15,代码来源:LocSample.java

示例13: processMovieDetails

import android.database.Cursor; //导入方法依赖的package包/类
/**
 * Process the Movie Details data.
 * @param jObj object
 */
private void processMovieDetails(JSONObject jObj) {
    if (jObj != null) {
        try {
            detailsData = new MovieData(getStringValue(jObj, "poster_path"),
                    movieID, getStringValue(jObj, "title"),
                    getStringValue(jObj, "overview"),
                    getStringValue(jObj, "release_date"),
                    getIntValue(jObj, "runtime", 0),
                    getDoubleValue(jObj, "vote_average", 0.0),
                    getIntValue(jObj, "vote_count", 0),
                    getStringValue(jObj, "backdrop_path"),
                    getStringValue(jObj, "original_language"),
                    getListValue(jObj, "production_countries", "name"),
                    getListValue(jObj, "genres", "name"),
                    getStringValue(jObj, "status"),
                    getUriValue(jObj, "imdb_uri" + IMDB_URI),
                    getListValue(jObj, "production_companies", "name"),
                    getLongValue(jObj, "budget", 0L),
                    getLongValue(jObj, "revenue", 0L),
                    getStringValue(jObj, "homepage"), getStringValue(jObj, "tagline"));
            populateDetails(detailsData);
        } catch (JSONException e) {
            if (LOG) {
                Log.e(TAG, "", e);
            }
        }

    } else {
        final Cursor cursor = getContentResolver().query(
                ContentUris.withAppendedId(URI, movieID),
                new String[]{ COLUMN_POSTER_PATH, COLUMN_TITLE, COLUMN_PLOT,
                        COLUMN_YEAR, COLUMN_DURATION, COLUMN_VOTE_AVERAGE, COLUMN_VOTE_COUNT,
                        COLUMN_BACKGROUND_PATH, COLUMN_ORIGINAL_LANGUAGE,
                        /*COLUMN_ORIGINAL_COUNTRIES, COLUMN_GENRES,*/ COLUMN_STATUS,
                        COLUMN_IMDB_ID/*, COLUMN_PROD_COMPANIES */, COLUMN_BUDGET,
                        COLUMN_REVENUE, COLUMN_HOMEPAGE, COLUMN_TAGLINE},
                null, null, null);

        if (cursor.getCount() != 0) {
            if (LOG) {
                Log.d(TAG, "Cursor = " + cursor.getCount());
            }
            cursor.moveToFirst();
            // Note: Better if it matches the query order
            detailsData = new MovieData(cursor.getString(0), movieID,
                    cursor.getString(1), cursor.getString(2), cursor.getString(3),
                    cursor.getInt(4), cursor.getDouble(5), cursor.getInt(6),
                    cursor.getString(7), cursor.getString(8), Collections.<String>emptyList(),
                    Collections.<String>emptyList(), cursor.getString(9),
                    cursor.getString(10), Collections.<String>emptyList(),
                    (long)cursor.getInt(11), (long)cursor.getInt(12), cursor.getString(13),
                    cursor.getString(14));
            populateDetails(detailsData);
        }
        cursor.close();
    }
}
 
开发者ID:an-garcia,项目名称:MovieGuide,代码行数:62,代码来源:MovieActivity.java

示例14: transformSearchCursor

import android.database.Cursor; //导入方法依赖的package包/类
private List<Pharmacy> transformSearchCursor(Cursor data){
    List<Pharmacy> list = new ArrayList<Pharmacy>(data.getCount());
    if(data.moveToFirst()) {
        do {
            Pharmacy farmacia = new Pharmacy();
            farmacia.setName(data.getString(data.getColumnIndex(DbContract.FarmaciasEntity.NAME)));
            farmacia.setAddress(data.getString(data.getColumnIndex(DbContract.FarmaciasEntity.ADDRESS)));
            farmacia.setLocality(data.getString(data.getColumnIndex(DbContract.FarmaciasEntity.LOCALITY)));
            farmacia.setProvince(data.getString(data.getColumnIndex(DbContract.FarmaciasEntity.PROVINCE)));
            farmacia.setPostal_code(data.getString(data.getColumnIndex(DbContract.FarmaciasEntity.POSTAL_CODE)));
            String phone = data.getString(data.getColumnIndex(DbContract.FarmaciasEntity.PHONE));
            farmacia.setPhone(phone);
            farmacia.setPhoneFormatted(Utils.formatPhoneNumber(phone));
            double latDest = data.getDouble(data.getColumnIndex(DbContract.FarmaciasEntity.LAT));
            double lonDest = data.getDouble(data.getColumnIndex(DbContract.FarmaciasEntity.LON));
            double distance = SphericalUtil.computeDistanceBetween(new LatLng(latDest,lonDest),
                    new LatLng(mLocation.getLatitude(),mLocation.getLongitude()));
            //double distance = Utils.meterDistanceBetweenPoints(latDest, lonDest, mLocation.getLatitude(), mLocation.getLongitude());
            farmacia.setLat(latDest);
            farmacia.setLon(lonDest);
            farmacia.setDistance(distance / 1000);

            String hours = data.getString(data.getColumnIndex(DbContract.FarmaciasEntity.HOURS));
            farmacia.setHours(hours);
            farmacia.setOpen(Utils.isPharmacyOpen(hours));
            String addressFormatted = Utils.formatAddress(farmacia.getAddress(),
                    farmacia.getPostal_code(),
                    farmacia.getLocality(),
                    farmacia.getProvince());
            farmacia.setAddressFormatted(addressFormatted);


            boolean favorite;
            int j = data.getInt(data.getColumnIndex(DbContract.FarmaciasEntity.FAVORITE));
            if (j == 0) {
                favorite = false;
            } else {
                favorite = true;
            }

            farmacia.setFavorite(favorite);
            list.add(farmacia);
        } while (data.moveToNext());
    }
    return list;

}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:48,代码来源:FavoritePresenter.java

示例15: buildAssets

import android.database.Cursor; //导入方法依赖的package包/类
private static WritableArray buildAssets(Cursor assetsCursor, WritableMap response,
    int limit) {
    assetsCursor.moveToFirst();
    int idIndex = assetsCursor.getColumnIndex(Images.Media._ID);
    int mimeTypeIndex = assetsCursor.getColumnIndex(Images.Media.MIME_TYPE);
    int dateTakenIndex = assetsCursor.getColumnIndex(Images.Media.DATE_TAKEN);
    int widthIndex = assetsCursor.getColumnIndex(Images.Media.WIDTH);
    int heightIndex = assetsCursor.getColumnIndex(Images.Media.HEIGHT);
    int longitudeIndex = assetsCursor.getColumnIndex(Images.Media.LONGITUDE);
    int latitudeIndex = assetsCursor.getColumnIndex(Images.Media.LATITUDE);
    int filenameIndex = assetsCursor.getColumnIndex(Images.Media.DISPLAY_NAME);

    WritableArray assets = new WritableNativeArray();
    for (int i = 0; i < limit && !assetsCursor.isAfterLast(); i++) {
        WritableMap asset = new WritableNativeMap();
        asset.putDouble("width", assetsCursor.getInt(widthIndex));
        asset.putDouble("height", assetsCursor.getInt(heightIndex));
        asset.putString("filename", assetsCursor.getString(filenameIndex));
        asset.putDouble("timestamp", assetsCursor.getLong(dateTakenIndex) / 1000d);

        String mimeType = assetsCursor.getString(mimeTypeIndex);
        if (mimeType.startsWith("image/")) {
            Uri photoUri = Uri.withAppendedPath(Images.Media.EXTERNAL_CONTENT_URI,
                    assetsCursor.getString(idIndex));
            asset.putString("uri", photoUri.toString());
            asset.putString("type", "image");
        } else {
            Uri videoUri = Uri.withAppendedPath(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
                    assetsCursor.getString(idIndex));
            asset.putString("uri", videoUri.toString());
            asset.putString("type", "video");
        }

        double longitude = assetsCursor.getDouble(longitudeIndex);
        double latitude = assetsCursor.getDouble(latitudeIndex);
        if (longitude > 0 || latitude > 0) {
            WritableMap location = new WritableNativeMap();
            location.putDouble("longitude", longitude);
            location.putDouble("latitude", latitude);
            asset.putMap("location", location);
        }

        assets.pushMap(asset);
        assetsCursor.moveToNext();
    }
    return assets;
}
 
开发者ID:chrisbianca,项目名称:react-native-cameraroll,代码行数:48,代码来源:RNCameraRollModule.java


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