- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试从 android 中的 sqlite db 中的表中获取两个值。我收到以下异常:
05-22 04:13:05.432: I/ActivityManager(251): app/com.nykkos.personalize[INITIAL] app.idle/false
05-22 04:13:05.432: I/ActivityManager(251): START {cmp=com.nykkos.personalize/.screens.PackageInstaller} from pid 1613
05-22 04:13:05.463: W/audio_hw_primary(134): select_output_device e=0, h=0, s=2, b=0
05-22 04:13:05.502: I/ActivityManager(251): app/com.nykkos.personalize[RESUMED] app.idle/false ...realStartActivityLocked
05-22 04:13:05.526: E/SQLiteCursor(1613): requesting column name with table name -- /mnt/sdcard/googleCheckout/Saxo Trader.apk
05-22 04:13:05.526: E/SQLiteCursor(1613): java.lang.Exception
05-22 04:13:05.526: E/SQLiteCursor(1613): at android.database.sqlite.SQLiteCursor.getColumnIndex(SQLiteCursor.java:192)
05-22 04:13:05.526: E/SQLiteCursor(1613): at com.nykkos.personalize.db.SQLiteDBHelper.GetSelectedApplicationUrlList(SQLiteDBHelper.java:263)
05-22 04:13:05.526: E/SQLiteCursor(1613): at com.nykkos.personalize.screens.PackageInstaller.onCreate(PackageInstaller.java:42)
05-22 04:13:05.526: E/SQLiteCursor(1613): at android.app.Activity.performCreate(Activity.java:4465)
05-22 04:13:05.526: E/SQLiteCursor(1613): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-22 04:13:05.526: E/SQLiteCursor(1613): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1928)
05-22 04:13:05.526: E/SQLiteCursor(1613): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1989)
05-22 04:13:05.526: E/SQLiteCursor(1613): at android.app.ActivityThread.access$600(ActivityThread.java:125)
05-22 04:13:05.526: E/SQLiteCursor(1613): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1149)
05-22 04:13:05.526: E/SQLiteCursor(1613): at android.os.Handler.dispatchMessage(Handler.java:99)
05-22 04:13:05.526: E/SQLiteCursor(1613): at android.os.Looper.loop(Looper.java:137)
05-22 04:13:05.526: E/SQLiteCursor(1613): at android.app.ActivityThread.main(ActivityThread.java:4368)
05-22 04:13:05.526: E/SQLiteCursor(1613): at java.lang.reflect.Method.invokeNative(Native Method)
05-22 04:13:05.526: E/SQLiteCursor(1613): at java.lang.reflect.Method.invoke(Method.java:511)
05-22 04:13:05.526: E/SQLiteCursor(1613): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-22 04:13:05.526: E/SQLiteCursor(1613): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-22 04:13:05.526: E/SQLiteCursor(1613): at dalvik.system.NativeStart.main(Native Method)
05-22 04:13:05.526: E/CursorWindow(1613): Failed to read row 0, column -1 from a CursorWindow which has 3 rows, 2 columns.
05-22 04:13:05.526: D/AndroidRuntime(1613): Shutting down VM
05-22 04:13:05.526: W/dalvikvm(1613): threadid=1: thread exiting with uncaught exception (group=0x40b0a1f8)
05-22 04:13:05.526: E/AndroidRuntime(1613): FATAL EXCEPTION: main
05-22 04:13:05.526: E/AndroidRuntime(1613): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nykkos.personalize/com.nykkos.personalize.screens.PackageInstaller}: java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
05-22 04:13:05.526: E/AndroidRuntime(1613): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1964)
05-22 04:13:05.526: E/AndroidRuntime(1613): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1989)
05-22 04:13:05.526: E/AndroidRuntime(1613): at android.app.ActivityThread.access$600(ActivityThread.java:125)
05-22 04:13:05.526: E/AndroidRuntime(1613): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1149)
05-22 04:13:05.526: E/AndroidRuntime(1613): at android.os.Handler.dispatchMessage(Handler.java:99)
05-22 04:13:05.526: E/AndroidRuntime(1613): at android.os.Looper.loop(Looper.java:137)
05-22 04:13:05.526: E/AndroidRuntime(1613): at android.app.ActivityThread.main(ActivityThread.java:4368)
05-22 04:13:05.526: E/AndroidRuntime(1613): at java.lang.reflect.Method.invokeNative(Native Method)
05-22 04:13:05.526: E/AndroidRuntime(1613): at java.lang.reflect.Method.invoke(Method.java:511)
05-22 04:13:05.526: E/AndroidRuntime(1613): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-22 04:13:05.526: E/AndroidRuntime(1613): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-22 04:13:05.526: E/AndroidRuntime(1613): at dalvik.system.NativeStart.main(Native Method)
05-22 04:13:05.526: E/AndroidRuntime(1613): Caused by: java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
05-22 04:13:05.526: E/AndroidRuntime(1613): at android.database.CursorWindow.nativeGetString(Native Method)
05-22 04:13:05.526: E/AndroidRuntime(1613): at android.database.CursorWindow.getString(CursorWindow.java:451)
05-22 04:13:05.526: E/AndroidRuntime(1613): at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
05-22 04:13:05.526: E/AndroidRuntime(1613): at com.nykkos.personalize.db.SQLiteDBHelper.GetSelectedApplicationUrlList(SQLiteDBHelper.java:263)
05-22 04:13:05.526: E/AndroidRuntime(1613): at com.nykkos.personalize.screens.PackageInstaller.onCreate(PackageInstaller.java:42)
05-22 04:13:05.526: E/AndroidRuntime(1613): at android.app.Activity.performCreate(Activity.java:4465)
05-22 04:13:05.526: E/AndroidRuntime(1613): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-22 04:13:05.526: E/AndroidRuntime(1613): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1928)
05-22 04:13:05.526: E/AndroidRuntime(1613): ... 11 more
05-22 04:13:05.526: W/ActivityManager(251): Force finishing activity com.nykkos.personalize/.screens.PackageInstaller
05-22 04:13:05.541: I/WindowManager(251): createSurface Window{42411fd0 paused=false}: DRAW NOW PENDING
05-22 04:13:06.025: W/ActivityManager(251): Activity pause timeout for ActivityRecord{41c0ee08 com.nykkos.personalize/.screens.PackageInstaller}
05-22 04:13:06.033: I/ActivityManager(251): app/com.nykkos.personalize[RESUMED] app.idle/true ...resumeTopActivityLocked
以下是我使用的代码:
public Map<String, String> GetSelectedApplicationUrlList() {
Cursor c = myDataBase.rawQuery("SELECT reco_index_user_action_download_file ," +
" reco_index_content_code from tbl_reco_index_contents where reco_index_content_type =" +
" 'Application/Widget' and reco_index_user_action_downloaded=1 and reco_index_user_action_installed =1 ",
null);
Map<String, String> sel = Collections
.synchronizedMap(new LinkedHashMap<String, String>());
if (c != null) {
if (c.moveToFirst()) {
do {
System.out.println("Url is"+c.getString(0));
System.out.println("Code is"+c.getString(1));
String url = c.getString(c.getColumnIndex(c.getString(0)));
String code = c.getString(c.getColumnIndex(c.getString(1)));
sel.put(code, url);
} while (c.moveToNext());
}
}
c.close();
return sel;
}
异常是从以下位置抛出的:
System.out.println("Url is"+c.getString(0));
当我从 sqliteman 运行相同的查询时,它总是给出正确的结果。
非常感谢任何解决此问题的帮助
表结构如下:
CREATE TABLE tbl_reco_index_contents (
id integer PRIMARY KEY,
reco_index_content_code char(10),
reco_index_content_type char(30),
reco_index_user_action_downloaded smallint,
reco_index_user_action_download_file char(50),
reco_index_user_action_installed smallint
)
最佳答案
第三行是问题所在。查看您的 logcat 输出和 Android sources (在源中搜索“请求带有表名的列名”)。现在看一下 logcat 输出。包含这句话的行包含您请求的列名称:/mnt/sdcard/googleCheckout/Saxo Trader.apk
。该值来自您的结果光标。当然,您的数据库不包含此列:-)
替换行
String url = c.getString(c.getColumnIndex(c.getString(0)));
String code = c.getString(c.getColumnIndex(c.getString(1)));
与
String url = c.getString(c.getColumnIndex("reco_index_user_action_download_file"));
String code = c.getString(c.getColumnIndex("reco_index_content_code"));
我还建议将用于获取索引的代码从循环内拉到循环外。无需一遍又一遍地询问索引。
关于来自 CursorWindow 的 java.lang.IllegalStateException : Couldn't read row 0, col -1 - Android sqlite 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16683453/
我有一个照片库的标准循环,我正在使用 twitter-bootstrap col-xs-12 col-sm-6 col-md-4 col-lg-3 这让我在桌面上看到 4 张图片,在移动设备上缩小到单
我有一个关于 bootstrap 3.0 类顺序的问题,现在如果我在从 sm 到 lg 的地方写下以下内容:- 如果我将类(class)顺序从 lg 更改为 sm,会有什么不同吗:- 或者顺序无关
如果类中没有指定col-lg和col-md,那么col-sm是否适用于所有大屏? 最佳答案 是的。 来自 bootstrap , Grid classes apply to devices with
我有一个概念,希望你能帮助澄清: 以下三种引用 PySpark 数据框中列的方式有什么区别。我知道不同的情况需要不同的形式,但不知道为什么。 df.col :例如F.count(df.col) df[
我们的代码是用C写的,DB是Informix。我们正在对 ESQL 程序进行一些代码优化,发现以下查询: UPDATE [TABLE] SET [PRIMARY KEY COLUMN] = [NEW
我的网站需要 3*3 的响应式服务框。但对齐方式不正确。第一行中的每个框在第二行中都不同,最后一个框正在移动到第四行。因此需要 3*3 框类型的代码。
我们发现这些查询之间存在巨大差异。 查询速度慢 SELECT MIN(col) AS Firstdate, MAX(col) AS Lastdate FROM table WHERE status =
如何在 gnuplot 中执行此操作: plot "test.csv" using 1:2 if value_in_column_3 == 80.0 它应该只选择第 3 列 == 80.0 的行并忽略
不确定从哪里开始 - 不确定问题是我在愚弄查询优化器,还是涉及空值时索引工作方式的固有问题。 我遵循的一个编码惯例是像这样编写存储过程: declare procedure SomeProc @I
两者之间有什么区别吗: CONCAT_WS('', 列)='' 和 列为空或列=0 *(以及可选的“OR column="”')* 其中一个更好/更快吗......? SELECT my_fields
我有一个像这样的数据框: ColA ColB ColC "lorem ipsum" ["lorem", "foo"
我在编写查询时遇到问题。假设我有一个包含汽车制造商和型号的表格,但我想删除所有与型号列表无关的行,我已经写了这个... DELETE FROM `cars` WHERE `make` != 'Ford
而不是使用 我可以这样做吗, ? 即MyCOLUMS = col-xs-1 col-sm-2 col-md-3 col-lg-4 . 如果可能,请解释如何实现?如果此方法错误,请解释错误原因。 最佳答
我必须在机器学习之前做一些数据清理,我的数据框如下所示: +-------+--------+---------+--------+-------+| userid|artistid|playcoun
在我的左边col我有一个 在我的右边col我有一些文字。我要左边col与右侧高度相同col .然后我想要 填补左边col .看起来很简单,但我做不到。这是我当前的代码:
我很好奇替换是否正确 ... ... 与 ... ... 用javascript? 我所需要的只是隐藏第二个 div 并正确地通过 javascript 显示第一个 div 的 100%。实际完成的操
我尝试了很多不同的解决方案:将类中心 block 添加到“行”,将“行”包装在 .我只想有 4 个 imges,居中,但它们被移到了左边。请帮助我,我的错误是什么?谢谢。
假设我有 COUNTRY |邮政编码 列。会有很多重复项,但大多数情况下,一些 COUNTRY 值将丢失,而 POSTAL CODE 将出现。如何在 POSTAL CODE 匹配的其他行中用 COUN
Twitter Bootstrap 中的 col-lg-* 、col-md-* 和 col-sm-* 有什么区别? 最佳答案 2020 年更新... Bootstrap 5 在 Bootstrap 5
问题:IE8 仅考虑我的带有 col-x 类的网格布局。我发现了一个相关/类似的问题IE8 issue with Twitter Bootstrap 3 wrt Respond.js 和 htm5sh
我是一名优秀的程序员,十分优秀!