用户登录
用户注册

分享至

使用 Android 和 SQLite 从数据库中获取布尔值

  • 作者: 火星游客在江湖
  • 来源: 51数据库
  • 2022-12-09

问题描述

如何在 Android 上的 SQLite 数据库中获取布尔字段的值?

How can I obtain the value of a boolean field in an SQLite database on Android?

我一般使用getString()、getInt()等来获取我的字段的值,但是好像没有getBoolean() 方法.

I usually use getString(), getInt(), etc. to get the values of my fields, but there does not seem to be a getBoolean() method.

推荐答案

是:

boolean value = cursor.getInt(boolean_column_index) > 0;
软件
前端设计
程序设计
Java相关