小编use*_*323的帖子

android.database.sqlite.SQLiteCantOpenDatabaseException:未知错误(代码14):无法打开数据库

我已经在网站上阅读了有关此问题的各种内容,但我无法弄清楚这一点.我正在为这个应用程序使用预构建数据库.我正在使用jellybean这个应用程序.

AndroidManifest.xml中

<?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.quotes"
        android:versionCode="1"
        android:versionName="1.0" >

        <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="17" />

        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            <activity
                android:name="com.example.quotes.MainActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>

    </manifest>
Run Code Online (Sandbox Code Playgroud)

Logcat输出

根据logcat它是由SQLiteCantOpenDatabaseException引起的

06-10 23:07:01.831: E/Trace(4419): error opening trace file: No such file or directory (2)
06-10 23:07:03.611: E/SQLiteLog(4419): (14) cannot open file at line 30176 of [00bb9c9ce4]
06-10 23:07:03.621: E/SQLiteLog(4419): (14) os_unix.c:30176: (2) open(/data/data/com.example.quotes/databasesQuotesdb) - 
06-10 23:07:03.641: E/SQLiteDatabase(4419): Failed to open database '/data/data/com.example.quotes/databasesQuotesdb'.
06-10 …
Run Code Online (Sandbox Code Playgroud)

android android-sqlite

61
推荐指数
6
解决办法
12万
查看次数

android.database.CursorIndexOutOfBoundsException:请求索引1,大小为1

//这不起作用 它显示第一个记录并在此之后停止.我想要一个即使在最后一条记录之后也能继续运行的循环.我明白了光标从位置0开始
.//代码

cur=db.getData(position);

    switch(v.getId())
    {

    case R.id.next :
    { 

        if (cur != null && cur.getCount()> 0 && position < cur.getCount() && position != cur.getCount()){
            cur.moveToPosition(position);
            textView1.setText(""+cur.getString(1));// Display Columns 
            position++;
            cur.moveToNext();
        }
}
Run Code Online (Sandbox Code Playgroud)

//我想要一个循环来显示记录号

下一个按钮,例如:

1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 
Run Code Online (Sandbox Code Playgroud)

后退按钮例如:

5 4 3 2 1 5 4 3 2 1
Run Code Online (Sandbox Code Playgroud)

随机按钮例如:

3 4 5 1
5 1 2 3
4 5 1 2 
Run Code Online (Sandbox Code Playgroud)

android cursor

0
推荐指数
1
解决办法
2448
查看次数

标签 统计

android ×2

android-sqlite ×1

cursor ×1