Fixed
Status Update
Comments
yb...@google.com <yb...@google.com>
da...@google.com <da...@google.com> #2
I have a same problem.
Internally, NavController#navigateUp() calls popBackStack().
And popBackStack() calls popBackStack(currentDestination.id, inclusive=true).
public boolean popBackStack() {
if (mBackStack.isEmpty()) {
// Nothing to pop if the back stack is empty
return false;
}
// Pop just the current destination off the stack
return popBackStack(getCurrentDestination().getId(), true); <--- this is cause.
}
So I think,
this problem can't be fixed without navigation cmpt. modification. :(
Internally, NavController#navigateUp() calls popBackStack().
And popBackStack() calls popBackStack(currentDestination.id, inclusive=true).
public boolean popBackStack() {
if (mBackStack.isEmpty()) {
// Nothing to pop if the back stack is empty
return false;
}
// Pop just the current destination off the stack
return popBackStack(getCurrentDestination().getId(), true); <--- this is cause.
}
So I think,
this problem can't be fixed without navigation cmpt. modification. :(
he...@gmail.com <he...@gmail.com> #3
Component used: Navigation
Version used: 1.0.0-alpha09
But on alpha09 version, popBackStack() is implemented differently.
public boolean popBackStack() {
if (mBackStack.isEmpty()) {
throw new IllegalArgumentException("NavController back stack is empty");
}
boolean popped = false;
while (!mBackStack.isEmpty()) {
popped = mBackStack.removeLast().getNavigator().popBackStack(); <------ different
if (popped) {
break;
}
}
return popped;
}
Please restore to the upper codes. Or create a new option. :)
Version used: 1.0.0-alpha09
But on alpha09 version, popBackStack() is implemented differently.
public boolean popBackStack() {
if (mBackStack.isEmpty()) {
throw new IllegalArgumentException("NavController back stack is empty");
}
boolean popped = false;
while (!mBackStack.isEmpty()) {
popped = mBackStack.removeLast().getNavigator().popBackStack(); <------ different
if (popped) {
break;
}
}
return popped;
}
Please restore to the upper codes. Or create a new option. :)
Description
Version used:1.1.1
Devices/Android versions reproduced on: All
File: FrameworkSQLiteOpenHelper
FrameworkSQLiteDatabase getWrappedDb(SQLiteDatabase sqLiteDatabase) {
FrameworkSQLiteDatabase dbRef = mDbRef[0];
if (dbRef == null) {
dbRef = new FrameworkSQLiteDatabase(sqLiteDatabase);
mDbRef[0] = dbRef;
}
return mDbRef[0];
}
Room always preserve The First Open db, even if it is closed.
Sometimes sqLiteDatabase != mDbRef[0].mDelegate, we get the wrong db from room.
This occurs when opening db, then something wrong and throws exception, but app caught it. The next time we use room, it throws re-open exception.
I thinks mDbRef[0].mDelegate should change when sqLiteDatabase is changed.
Like this:
FrameworkSQLiteDatabase getWrappedDb(SQLiteDatabase sqLiteDatabase) {
FrameworkSQLiteDatabase dbRef = mDbRef[0];
if (dbRef == null || dbRef.isDatabaseChanged(sqLiteDatabase)) {
dbRef = new FrameworkSQLiteDatabase(sqLiteDatabase);
mDbRef[0] = dbRef;
}
return mDbRef[0];
}
File: FrameworkSQLiteDatabase
public boolean isDatabaseChanged(SQLiteDatabase db) {
return mDelegate != db;
}