DatabaseObjectNotClosedException:应用程序未关闭此处打开的游标或数据库对象

时间:2017-05-14 03:57:56

标签: android database firebase

当我通过Twitter在Digits中使用Firebase时,我遇到了这个例外。我正在使用来自twitter的数字。我找到了一个解决方案,但到现在为止我没有任何成功。 `

digitsButton.setCallback(new AuthCallback() {
        @Override
        public void success(DigitsSession session, String phoneNumber) {
            // TODO: associate the session user ID with your user model

            firebaseReference.addListenerForSingleValueEvent(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {
                    if (dataSnapshot.hasChild(phoneNumber)) {
                        if (!dataSnapshot.getValue(String.class).equals(phoneNumber)) {
                            firebaseReference.setValue(phoneNumber);
                            firebaseReference.removeEventListener(this);

                            startActivity(new Intent(LoginActivity.this, SignupActivity.class));

                        } else {
                            firebaseReference.removeEventListener(this);
                            startActivity(new Intent(LoginActivity.this, MainActivity.class));

                        }
                    }
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {

                }
            });

        }

        @Override
        public void failure(DigitsException exception) {
            Log.d("Digits", "Sign in with Digits failure", exception);
        }
    });

 Finalizing a Cursor that has not been deactivated or closed. database = /data/user/0/com.curieo.podcast.debug/databases/google_app_measurement_local.db, table = null, query = select count(1) from messages
                                                                android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
                                                                    at android.database.sqlite.SQLiteCursor.<init>(SQLiteCursor.java:104)
                                                                    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:50)
                                                                    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1346)
                                                                    at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1285)
                                                                    at com.google.android.gms.internal.zzatg.zza(Unknown Source)
                                                                    at com.google.android.gms.internal.zzatg.zza(Unknown Source)
                                                                    at com.google.android.gms.internal.zzatw.zzc(Unknown Source)
                                                                    at com.google.android.gms.internal.zzatu.zzb(Unknown Source)
                                                                    at com.google.android.gms.internal.zzatu.zza(Unknown Source)
                                                                    at com.google.android.gms.internal.zzatu$4.run(Unknown Source)
                                                                    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
                                                                    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                    at com.google.android.gms.internal.zzato$zzd.run(Unknown Source)

我已经被困在这几个小时,无法理解它是如何导致问题的

0 个答案:

没有答案