,   CyberForum.ru

Android


 
 
 
:  :  - 15,   - 4.87
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
#1

"Attempt to re-open an already-closed object" SQLite - Android

09.04.2015, 18:03. 2348. 41
( )

. ... :

FATAL EXCEPTION: main
java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase:

Log.v , , , .
, , ... . .


.
EventActivity.java
Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_event);
 
        Log.v(TAG, "    " );
 
        //    
        db = new DB(this);
        db.open();
 
        Log.v(TAG, "- " );
 
        //  
 
        edtMan = (Spinner) findViewById(R.id.ManSpinner);
        edtET = (Spinner) findViewById(R.id.ETSpinner);
        edtMeet = (Spinner) findViewById(R.id.MeetingSpinner);
 
        // MAN - EVENT TYPE - MEET
        CreatNewSpinnerFU("man", "name", edtMan);
        CreatNewSpinnerFU("event_type", "name", edtET);
        CreatNewSpinnerFU("meeting", "name", edtMeet);
 
 
        checkboxEvent = (CheckBox) findViewById(R.id.checkBox);
 
        Log.v(TAG, "Ĩ '' " );
 
        btnEvent  = (Button) findViewById(R.id.new_event_in_tab);
        btnEvent.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // Do something in response to button click
 
                boolean checkMan= !true,
                        checkET = !true,
                        checkMeet = !true;
 
                Log.v(TAG, "!" );
 
                //checkMan = !true; checkET = !true; checkMeet = !true;
 
                Log.v(TAG, "   --- if (edtMan.getSelectedItem() != null) ---" );
 
                if (edtMan.getSelectedItem() != null)
                {
                    Log.v(TAG, "----if    -----" );
                    Log.v(TAG, "----if -----   checkMan = true;" );
                    checkMan = true;
                    Log.v(TAG, "----if -----   checkMan = true;-- " );
 
 
                    Log.v(TAG, "----if-----    cur = db.GetCatalogValueByName(.........);" );
                    cur = db.GetCatalogValueByName("man", "_id", "name", edtMan.getSelectedItem().toString());
                    Log.v(TAG, "----if-----    cur = db.GetCatalogValueByName(.........);-------" );
 
                    Log.v(TAG, "----if-----    _id ---- cManID = cur.getInt(...._id\")-----" );
                    cManID = cur.getInt(cur.getColumnIndex("_id"));
                    Log.v(TAG, "----if-----    _id ---- cManID = cur.getInt(...._id\")-----" );
                    //db.addRec("event", DB.EVENT_COLUMN_MAN, cManID );
                }
 
                Log.v(TAG, "  E  --- if (edtET.getSelectedItem() != null) ---" );
                if (edtET.getSelectedItem() != null)
                {
                    checkET = true;
                    cur = db.GetCatalogValueByName("event_type", "_id", "FullName", edtET.getSelectedItem().toString());
                    cETID = cur.getInt(cur.getColumnIndex("_id"));
                    //db.addRec("event", DB.EVENT_COLUMN_EVENT_TYPE, cETID );
                }
 
                Log.v(TAG, "   --- if (edtMeet.getSelectedItem() != null) ---" );
                if (edtMeet.getSelectedItem() != null)
                {
                    checkMeet = true;
                    cur = db.GetCatalogValueByName("event_type", "_id", "FullName", edtMeet.getSelectedItem().toString());
                    cMeetID = cur.getInt(cur.getColumnIndex("_id"));
                    //db.addRec("event", DB.EVENT_COLUMN_MEETING, cMeetID );
                }
 
                Log.v(TAG, "   'TRUE'     'event' --- if(checkMan != false & checkET != false & checkMeet != false) ---" );
 
                //   true,      "event"
                if(checkMan != false & checkET != false & checkMeet != false){
 
                    Log.v(TAG, "   ---- db.addRec(\"event\", DB.EVENT_COLUMN_MAN, cManID ); ---" );
                    db.addRec("event", DB.EVENT_COLUMN_MAN, cManID );
                    Log.v(TAG, "" );
 
                    Log.v(TAG, "   ---- db.addRec(\"event\", DB.EVENT_COLUMN_EVENT_TYPE, cETID ); ---" );
                    db.addRec("event", DB.EVENT_COLUMN_EVENT_TYPE, cETID );
                    Log.v(TAG, "" );
 
                    Log.v(TAG, "    ---- ---" );
                    db.addRec("event", DB.EVENT_COLUMN_MEETING, cMeetID );
 
                    if (checkboxEvent.isChecked() == true) {
                        db.addRec("event", DB.EVENT_COLUMN_VALUE, 1 );
                        Log.v(TAG, "---1" );
 
                    }else {
                        db.addRec("event", DB.EVENT_COLUMN_VALUE, 0 );
                        Log.v(TAG, "---0" );
                    }
 
                }
 
 
            }
        });
        db.close();
    }
// SPINNER
    public void CreatNewSpinnerFU(String name_table, String name_column, Spinner qwerty) {
        List ListArray = new ArrayList();
        Cursor Post = db.GetCatalogByName(name_table);
        Post.moveToFirst();
 
        if (Post != null && Post.getCount() > 0) {
            do {
                ListArray.add(Post.getString(Post.getColumnIndex(name_column)));
            } while (Post.moveToNext());
 
            ArrayAdapter dataAdapterPost = new ArrayAdapter(this, android.R.layout.simple_spinner_item, ListArray);
            dataAdapterPost.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            qwerty.setAdapter(dataAdapterPost);
        }
    }

.
BD.java
Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
public class DB {
 
    private static final String TAG = "DB__ACTIVITY";
 
 
    private static final String DB_NAME = "Allreg";
    private static final int DB_VERSION = 1;
    //man
    private static final String DB_TABLE = "man";
    public static final String COLUMN_ID = "_id";
    public static final String COLUMN_NAME = "name";
 
    private static final String DB_CREATE =
            "create table " + DB_TABLE + "(" +
                    COLUMN_ID + " integer primary key autoincrement, " +
                    COLUMN_NAME + " text" +
                    ");";
 
    //event type
    private static final String EVENT_TYPE_TABLE = "event_type";
    public static final String EVENT_TYPE_COLUMN_ID = "_id";
    public static final String EVENT_TYPE_COLUMN_NAME = "name";
 
    private static final String EVENT_TYPE_DB_CREATE =
            "create table " + EVENT_TYPE_TABLE + "(" +
                    EVENT_TYPE_COLUMN_ID + " integer primary key autoincrement, " +
                    EVENT_TYPE_COLUMN_NAME + " text" +
                    ");";
 
    //meeting
    private static final String MEETING_TABLE = "meeting";
    public static final String MEETING_COLUMN_ID = "_id";
    public static final String MEETING_COLUMN_NAME = "name";
 
    private static final String MEETING_DB_CREATE =
            "create table " + MEETING_TABLE + "(" +
                    MEETING_COLUMN_ID + " integer primary key autoincrement, " +
                    MEETING_COLUMN_NAME + " text" +
                    ");";
 
    //event
    private static final String EVENT_TABLE = "event";
    public static final String EVENT_COLUMN_ID = "_id";
    public static final String EVENT_COLUMN_MAN = "ManId";
    public static final String EVENT_COLUMN_MEETING = "MeetingId";
    public static final String EVENT_COLUMN_EVENT_TYPE = "EventTypeId";
    public static final String EVENT_COLUMN_VALUE = "Value";
 
    private static final String EVENT_DB_CREATE =
            "create table " + EVENT_TABLE + "(" +
                    EVENT_COLUMN_ID + " integer primary key autoincrement, " +
                    EVENT_COLUMN_MAN + " integer" +
                    EVENT_COLUMN_MEETING + " integer" +
                    EVENT_COLUMN_EVENT_TYPE + " integer" +
                    EVENT_COLUMN_VALUE + " integer" +
                    ");";
 
    private final Context mCtx;
 
 
    private DBHelper mDBHelper;
    private SQLiteDatabase mDB;
 
    public DB(Context ctx) {
        mCtx = ctx;
    }
 
    //  
    public void open() {
        mDBHelper = new DBHelper(mCtx, DB_NAME, null, DB_VERSION);
        mDB = mDBHelper.getWritableDatabase();
    }
 
    //  
    public void close() {
        if (mDBHelper!=null) mDBHelper.close();
    }
 
    //      DB_TABLE
    public Cursor getAllData(String name_DB) {
        String str = name_DB;
        return mDB.query(str, null, null, null, null, null, null);
    }
 
    //    DB_TABLE
    //-----------------------------------   _id
    public void delRec(String name_DB , String column_id , long id) {
        String str = name_DB;
        String col_id = column_id;
        mDB.delete(name_DB, col_id + " = " + id, null);
    }
 
    //    
    //    
    public Cursor GetCatalogByName(String FullName)
    {
        Cursor cur = mDB.rawQuery("select * from " + FullName.toString() , null);
        cur.moveToFirst();
        return cur;
    }
 
    //         
    public Cursor GetCatalogValueByName(String CatalogFullName,
                                        String FieldFullName,
                                        String ConditionField,
                                        String Value)
    {
        //Open();
 
        Log.v(TAG, "----  GetCatalogValueByName----");
 
        Log.v(TAG,"---  ." + " select " + FieldFullName + " from " + CatalogFullName +
                " where " + ConditionField + " = '" + Value + "'" );
 
        Cursor cur = mDB.rawQuery(" select " + FieldFullName +
                " from " + CatalogFullName +
                " where " + ConditionField + " = '" + Value + "'"
                , null);
 
        Log.v(TAG, " select " + FieldFullName +
                " from " + CatalogFullName +
                " where " + ConditionField + " = '" + Value + "'");
 
        cur.moveToFirst();
        //Close();
 
        Log.v(TAG, cur.getCount() + "");
 
        return cur;
    }
 
    //      
    private class DBHelper extends SQLiteOpenHelper {
 
        public DBHelper(Context context, String name, CursorFactory factory,
                        int version) {
            super(context, name, factory, version);
        }
 
        //    
        @Override
        public void onCreate(SQLiteDatabase db) {
            db.execSQL(DB_CREATE);
            db.execSQL(EVENT_TYPE_DB_CREATE);
            db.execSQL(MEETING_DB_CREATE);
            db.execSQL(EVENT_DB_CREATE);
 
        }
 
        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        }
    }
}




Prolog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
04-09 15:46:08.708  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕     
04-09 15:46:08.728  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ - 
04-09 15:46:08.728  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ Ĩ '' 
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ !
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    --- if (edtMan.getSelectedItem() != null) ---
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if    -----
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;-- 
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    cur = db.GetCatalogValueByName(.........);
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ----  GetCatalogValueByName----
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---  .
    select _id from man where name = ' '
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg D/AndroidRuntime﹕ Shutting down VM
04-09 15:46:12.092  10679-10679/com.example.kirukato.coolstdreg W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x4154d8b0)
04-09 15:46:12.102  10679-10679/com.example.kirukato.coolstdreg E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/com.example.kirukato.coolstdreg/databases/Allreg
            at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
            at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1318)
            at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1261)
            at com.example.kirukato.coolstdreg.DB.GetCatalogValueByName(DB.java:154)
            at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:96)
            at android.view.View.performClick(View.java:4421)
            at android.view.View$PerformClick.run(View.java:17903)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:5225)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
            at dalvik.system.NativeStart.main(Native Method)
, . .
0
Similar
41792 / 34177 / 6122
: 12.04.2006
: 57,940
09.04.2015, 18:03
! "Attempt to re-open an already-closed object" SQLite ( Android):

"Attempting to invoke method on a null object reference" - Android
! . Add Attempting to invoke interface method java.sql.Statement...

SQLite, : "" - Android
SQLite. : . 3 : , ...

(Spinner) "->" c SQLite - Android
...

Attempt to invoke virtual method on a null object reference - Android
, , firebase. public class Tab3Activity...

Attempt to invoke virtual method on a null object reference - Android
. . . : Caused by: java.lang.NullPointerException: Attempt to...

"" SQLite - Android
, : "" , ...

? .
Rube
911 / 559 / 88
: 13.02.2014
: 2,071
09.04.2015, 18:28 #2
db.close() onPause()
Post.close()
0
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
09.04.2015, 18:56  [] #3
Rube, . EventActivity.java onCreate db.close() Post.close()? ?

24
Rube .

Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 public void onPause()
    {
        super.onPause();
        Log.d("on pause", " / ");
        db.close();
    }
 
 
    // SPINNER
    public void CreatNewSpinnerFU(String name_table, String name_column, Spinner qwerty) {
        List ListArray = new ArrayList();
        Cursor Post = db.GetCatalogByName(name_table);
        Post.moveToFirst();
 
        if (Post != null && Post.getCount() > 0) {
            do {
                ListArray.add(Post.getString(Post.getColumnIndex(name_column)));
            } while (Post.moveToNext());
 
            ArrayAdapter dataAdapterPost = new ArrayAdapter(this, android.R.layout.simple_spinner_item, ListArray);
            dataAdapterPost.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            qwerty.setAdapter(dataAdapterPost);
        }
        Post.close();
    }
. :
Prolog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
04-09 18:51:00.922  20943-20943/com.example.kirukato.coolstdreg D/dalvikvm﹕ Late-enabling CheckJNI
04-09 18:51:01.293  20943-20943/com.example.kirukato.coolstdreg D/libEGL﹕ loaded /vendor/lib/egl/libEGL_adreno.so
04-09 18:51:01.303  20943-20943/com.example.kirukato.coolstdreg D/libEGL﹕ loaded /vendor/lib/egl/libGLESv1_CM_adreno.so
04-09 18:51:01.353  20943-20943/com.example.kirukato.coolstdreg D/libEGL﹕ loaded /vendor/lib/egl/libGLESv2_adreno.so
04-09 18:51:01.363  20943-20943/com.example.kirukato.coolstdreg I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:316>: EGL 1.4 QUALCOMM build:  (CL4169980)
    OpenGL ES Shader Compiler Version: 17.01.10.SPL
    Build Date: 11/04/13 Mon
    Local Branch:
    Remote Branch:
    Local Patches:
    Reconstruct Branch:
04-09 18:51:01.623  20943-20943/com.example.kirukato.coolstdreg D/OpenGLRenderer﹕ Enabling debug mode 0
04-09 18:51:13.636  20943-20943/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕     
04-09 18:51:13.636  20943-20943/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ - 
04-09 18:51:13.646  20943-20943/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ Ĩ '' 
04-09 18:51:15.658  20943-20943/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ !
04-09 18:51:15.658  20943-20943/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    --- if (edtMan.getSelectedItem() != null) ---
04-09 18:51:15.658  20943-20943/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if    -----
04-09 18:51:15.658  20943-20943/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;
04-09 18:51:15.658  20943-20943/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;-- 
04-09 18:51:15.658  20943-20943/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    cur = db.GetCatalogValueByName(.........);
04-09 18:51:15.658  20943-20943/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ----  GetCatalogValueByName----
04-09 18:51:15.668  20943-20943/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---  . select _id from man where name = ' '
04-09 18:51:15.678  20943-20943/com.example.kirukato.coolstdreg D/AndroidRuntime﹕ Shutting down VM
04-09 18:51:15.678  20943-20943/com.example.kirukato.coolstdreg W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x4154d8b0)
04-09 18:51:15.708  20943-20943/com.example.kirukato.coolstdreg E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/com.example.kirukato.coolstdreg/databases/Allreg
            at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
            at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1318)
            at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1261)
            at com.example.kirukato.coolstdreg.DB.GetCatalogValueByName(DB.java:156)
            at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:96)
            at android.view.View.performClick(View.java:4421)
            at android.view.View$PerformClick.run(View.java:17903)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:5225)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
            at dalvik.system.NativeStart.main(Native Method)
0
Armagedo
208 / 208 / 60
: 22.08.2014
: 644
09.04.2015, 19:09 #4
?
http://touchlabblog.tumblr.com/post/...ite-connection
0
Rube
911 / 559 / 88
: 13.02.2014
: 2,071
09.04.2015, 19:29 #5
Armagedo, , ?
0
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
09.04.2015, 19:30  [] #6
Armagedo, , ? , DB.java, GetCatalogValueByName, cur = mDB.rawQuery(...), .

Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 public Cursor GetCatalogValueByName(String CatalogFullName,
                                        String FieldFullName,
                                        String ConditionField,
                                        String Value)
    {
        //Open();
 
        Log.v(TAG, "----  GetCatalogValueByName----");
 
        Log.v(TAG,"---  ." + " select " + FieldFullName + " from " + CatalogFullName +
                " where " + ConditionField + " = '" + Value + "'" );
 
        Cursor cur = mDB.rawQuery(" select " + FieldFullName +
                " from " + CatalogFullName +
                " where " + ConditionField + " = '" + Value + "'"
                , null);
 
        Log.v(TAG, " select " + FieldFullName +
                " from " + CatalogFullName +
                " where " + ConditionField + " = '" + Value + "'");
 
        cur.moveToFirst();
        //Close();
 
        Log.v(TAG, cur.getCount() + "");
 
        return cur;
    }
GetCatalogValueByName EventActivity.java :
Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
btnEvent  = (Button) findViewById(R.id.new_event_in_tab);
        btnEvent.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // Do something in response to button click
 
                boolean checkMan= !true,
                        checkET = !true,
                        checkMeet = !true;
 
                Log.v(TAG, "!" );
 
                //checkMan = !true; checkET = !true; checkMeet = !true;
 
                Log.v(TAG, "   --- if (edtMan.getSelectedItem() != null) ---" );
 
                if (edtMan.getSelectedItem() != null)
                {
                    Log.v(TAG, "----if    -----" );
                    Log.v(TAG, "----if -----   checkMan = true;" );
                    checkMan = true;
                    Log.v(TAG, "----if -----   checkMan = true;-- " );
 
 
                    Log.v(TAG, "----if-----    cur = db.GetCatalogValueByName(.........);\n" );
                    Log.v(TAG, " edtMan.getSelectedItem().toString()------" + edtMan.getSelectedItem().toString() );
                    cur = db.GetCatalogValueByName("man", "_id", "name", edtMan.getSelectedItem().toString());
                    Log.v(TAG, "----if-----    cur = db.GetCatalogValueByName(.........);-------" );
 
                    Log.v(TAG, "----if-----    _id ---- cManID = cur.getInt(...._id\")-----" );
                    cManID = cur.getInt(cur.getColumnIndex("_id"));
                    Log.v(TAG, "----if-----    _id ---- cManID = cur.getInt(...._id\")-----" );
                    //db.addRec("event", DB.EVENT_COLUMN_MAN, cManID );
                }
0
Armagedo
208 / 208 / 60
: 22.08.2014
: 644
09.04.2015, 19:39 #7
Rube,
, , .
, "", , - , .


..

Java
1
 db.close();
.
0
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
09.04.2015, 19:42  [] #8
, ? Spinner' , . ? ? . , .
0
Armagedo
208 / 208 / 60
: 22.08.2014
: 644
09.04.2015, 19:45 #9
Naomis, ?
0
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
09.04.2015, 19:48  [] #10
Armagedo
Naomis, ?
?
0
Armagedo
208 / 208 / 60
: 22.08.2014
: 644
09.04.2015, 19:53 #11
Naomis
?




Armagedo
..

Java
1
db.close();
.
0
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
09.04.2015, 19:57  [] #12
Armagedo, "db.close();" EventActivity.java onCreate?
0
Armagedo
208 / 208 / 60
: 22.08.2014
: 644
09.04.2015, 20:04 #13
Naomis
Armagedo, "db.close();" EventActivity.java onCreate?
, ...

"" , DB

Java
1
2
3
public void close() {
        if (mDBHelper!=null) mDBHelper.close();
    }
.
0
Naomis
6 / 6 / 1
: 11.03.2015
: 210
: 1
09.04.2015, 20:07  [] #14
Armagedo, db.close(); !!

Prolog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
04-09 19:47:32.231  28374-28380/com.example.kirukato.coolstdreg D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
04-09 19:57:15.747  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕     
04-09 19:57:15.757  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ - 
04-09 19:57:15.767  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ Ĩ '' 
04-09 19:57:21.734  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ !
04-09 19:57:21.734  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕    --- if (edtMan.getSelectedItem() != null) ---
04-09 19:57:21.734  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if    -----
04-09 19:57:21.734  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;
04-09 19:57:21.734  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if -----   checkMan = true;-- 
04-09 19:57:21.734  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    cur = db.GetCatalogValueByName(.........);
04-09 19:57:21.734  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕  edtMan.getSelectedItem().toString()------
04-09 19:57:21.744  30740-30740/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ----  GetCatalogValueByName----
04-09 19:57:21.744  30740-30740/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---  . select _id from man where name = ' '
04-09 19:57:21.744  30740-30740/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ select _id from man where name = ' '
04-09 19:57:21.744  30740-30740/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ 1
04-09 19:57:21.744  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    cur = db.GetCatalogValueByName(.........);-------
04-09 19:57:21.744  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    _id ---- cManID = cur.getInt(...._id")-----
04-09 19:57:21.744  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕ ----if-----    _id ---- cManID = cur.getInt(...._id")-----
04-09 19:57:21.744  30740-30740/com.example.kirukato.coolstdreg V/EVENT__ACTIVITY﹕   E  --- if (edtET.getSelectedItem() != null) ---
04-09 19:57:21.744  30740-30740/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ----  GetCatalogValueByName----
04-09 19:57:21.744  30740-30740/com.example.kirukato.coolstdreg V/DB__ACTIVITY﹕ ---  . select _id from event_type where FullName = '   '
04-09 19:57:21.744  30740-30740/com.example.kirukato.coolstdreg E/SQLiteLog﹕ (1) no such column: FullName
04-09 19:57:21.744  30740-30740/com.example.kirukato.coolstdreg D/AndroidRuntime﹕ Shutting down VM
04-09 19:57:21.744  30740-30740/com.example.kirukato.coolstdreg W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x4154d8b0)
04-09 19:57:21.754  30740-30740/com.example.kirukato.coolstdreg E/AndroidRuntime﹕ FATAL EXCEPTION: main
    android.database.sqlite.SQLiteException: no such column: FullName (code 1): , while compiling: select _id from event_type where FullName = '   '
            at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
            at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
            at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
            at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
            at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
            at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
            at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
            at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1322)
            at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1261)
            at com.example.kirukato.coolstdreg.DB.GetCatalogValueByName(DB.java:156)
            at com.example.kirukato.coolstdreg.EventActivity$1.onClick(EventActivity.java:109)
            at android.view.View.performClick(View.java:4421)
            at android.view.View$PerformClick.run(View.java:17903)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:5225)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
            at dalvik.system.NativeStart.main(Native Method)
, ...
Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Log.v(TAG, "   --- if (edtMan.getSelectedItem() != null) ---" );
 
                if (edtMan.getSelectedItem() != null)
                {
                    Log.v(TAG, "----if    -----" );
                    Log.v(TAG, "----if -----   checkMan = true;" );
                    checkMan = true;
                    Log.v(TAG, "----if -----   checkMan = true;-- " );
 
 
                    Log.v(TAG, "----if-----    cur = db.GetCatalogValueByName(.........);\n" );
                    Log.v(TAG, " edtMan.getSelectedItem().toString()------" + edtMan.getSelectedItem().toString() );
                    cur = db.GetCatalogValueByName("man", "_id", "name", edtMan.getSelectedItem().toString());
                    Log.v(TAG, "----if-----    cur = db.GetCatalogValueByName(.........);-------" );
 
                    Log.v(TAG, "----if-----    _id ---- cManID = cur.getInt(...._id\")-----" );
                    cManID = cur.getInt(cur.getColumnIndex("_id"));
                    Log.v(TAG, "----if-----    _id ---- cManID = cur.getInt(...._id\")-----" );
                    //db.addRec("event", DB.EVENT_COLUMN_MAN, cManID );
                }
.
.
Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
if (edtMan.getSelectedItem() != null)
                {
                    Log.v(TAG, "----if    -----" );
                    Log.v(TAG, "----if -----   checkMan = true;" );
                    checkMan = true;
                    Log.v(TAG, "----if -----   checkMan = true;-- " );
 
 
                    Log.v(TAG, "----if-----    cur = db.GetCatalogValueByName(.........);\n" );
                    Log.v(TAG, " edtMan.getSelectedItem().toString()------" + edtMan.getSelectedItem().toString() );
                    cur = db.GetCatalogValueByName("man", "_id", "name", edtMan.getSelectedItem().toString());
                    Log.v(TAG, "----if-----    cur = db.GetCatalogValueByName(.........);-------" );
 
                    Log.v(TAG, "----if-----    _id ---- cManID = cur.getInt(...._id\")-----" );
                    cManID = cur.getInt(cur.getColumnIndex("_id"));
                    Log.v(TAG, "----if-----    _id ---- cManID = cur.getInt(...._id\")-----" );
                    //db.addRec("event", DB.EVENT_COLUMN_MAN, cManID );
                }
 
                Log.v(TAG, "  E  --- if (edtET.getSelectedItem() != null) ---" );
                if (edtET.getSelectedItem() != null)
                {
                    checkET = true;
                    cur = db.GetCatalogValueByName("event_type", "_id", "FullName", edtET.getSelectedItem().toString());
                    cETID = cur.getInt(cur.getColumnIndex("_id"));
                    //db.addRec("event", DB.EVENT_COLUMN_EVENT_TYPE, cETID );
                }
 
                Log.v(TAG, "   --- if (edtMeet.getSelectedItem() != null) ---" );
                if (edtMeet.getSelectedItem() != null)
                {
                    checkMeet = true;
                    cur = db.GetCatalogValueByName("event_type", "_id", "FullName", edtMeet.getSelectedItem().toString());
                    cMeetID = cur.getInt(cur.getColumnIndex("_id"));
                    //db.addRec("event", DB.EVENT_COLUMN_MEETING, cMeetID );
                }
 
                Log.v(TAG, "   'TRUE'     'event' --- if(checkMan != false & checkET != false & checkMeet != false) ---" );
 
                //   true,      "event"
                if(checkMan != false & checkET != false & checkMeet != false){
 
                    Log.v(TAG, "   ---- db.addRec(\"event\", DB.EVENT_COLUMN_MAN, cManID ); ---" );
                    db.addRec("event", DB.EVENT_COLUMN_MAN, cManID );
                    Log.v(TAG, "" );
 
                    Log.v(TAG, "   ---- db.addRec(\"event\", DB.EVENT_COLUMN_EVENT_TYPE, cETID ); ---" );
                    db.addRec("event", DB.EVENT_COLUMN_EVENT_TYPE, cETID );
                    Log.v(TAG, "" );
 
                    Log.v(TAG, "    ---- ---" );
                    db.addRec("event", DB.EVENT_COLUMN_MEETING, cMeetID );
 
                    if (checkboxEvent.isChecked() == true) {
                        db.addRec("event", DB.EVENT_COLUMN_VALUE, 1 );
                        Log.v(TAG, "---1" );
 
                    }else {
                        db.addRec("event", DB.EVENT_COLUMN_VALUE, 0 );
                        Log.v(TAG, "---0" );
                    }
 
                }
1
Armagedo, , , .
0
Armagedo
208 / 208 / 60
: 22.08.2014
: 644
09.04.2015, 20:13 #15
Naomis
Armagedo, db.close(); !!
, , , , .

android.database.sqlite.SQLiteException: no such column: FullName (code 1): , while compiling: select _id from event_type where FullName = ' '
FullName - .

, .
0
MoreAnswers
37091 / 29110 / 5898
: 17.06.2006
: 43,301
09.04.2015, 20:13
! :

SQLite, " " - Android
! : SQLite - &quot;&quot;, &quot;&quot;. - ...

"Hello world" "android" - Android
! - . , google.developers . ...

sqlite - Android
, . SQL WHERE = ...

, "", "", "" - Android
, ! - - &quot;_&quot;, &quot;&quot;, &quot;&quot; ...




:
Yandex
09.04.2015, 20:13

- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
@Mail.ru