當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。