Obsolete
Status Update
Comments
ch...@orr.me.uk <ch...@orr.me.uk> #2
This actually has nothing to do with NavHostFragment, but is the behavior of NavController's setGraph().
When you call navController.setGraph(R.navigation.navigation_graph), it stores that ID and will restore that ID automatically.
If you were to instead use:
NavInflater navInflater = new NavInflater(this, navController.getNavigatorProvider());
navController.setGraph(navInflater.inflate(R.navigation.navigation_graph));
Then NavController would not restore the graph itself and the call to restoreState() you point out would only restore the back stack state, etc. but would wait for you to call setGraph again.
You're right that the inconsistency between the two setGraph methods is concerning. We'll take a look.
When you call navController.setGraph(R.navigation.navigation_graph), it stores that ID and will restore that ID automatically.
If you were to instead use:
NavInflater navInflater = new NavInflater(this, navController.getNavigatorProvider());
navController.setGraph(navInflater.inflate(R.navigation.navigation_graph));
Then NavController would not restore the graph itself and the call to restoreState() you point out would only restore the back stack state, etc. but would wait for you to call setGraph again.
You're right that the inconsistency between the two setGraph methods is concerning. We'll take a look.
ey...@gmail.com <ey...@gmail.com> #3
Turns out, we already had a tracking bug for this issue, will follow up on that other one.
en...@google.com <en...@google.com>
ch...@orr.me.uk <ch...@orr.me.uk> #4
Thank you for promptly replying to my report. You are right that the issue you've just mentioned is similar to mine. I shall continue observing the progress over there.
pe...@gmail.com <pe...@gmail.com> #5
Probably because you can add validation of TextUtils.isEmpty() on your method as a workaround and return false?
ra...@gmail.com <ra...@gmail.com> #7
this issue still exists in Android 7.0
le...@gmail.com <le...@gmail.com> #8
这么简单的bug,打死也不解决??
le...@gmail.com <le...@gmail.com> #9
So simple bug, would rather die do not solve?
mi...@gmail.com <mi...@gmail.com> #10
You can move this to appcompat and fix it there if it's too complicated to fix in public SDK.
#5 - Sure, you can always work around issues, but then we would be writing thousands of 3rd-party libraries to work around stuff. Oh wait...
#5 - Sure, you can always work around issues, but then we would be writing thousands of 3rd-party libraries to work around stuff. Oh wait...
sh...@gmail.com <sh...@gmail.com> #11
I will just file another issue.
sh...@gmail.com <sh...@gmail.com> #12
I found
Description
/**
* Returns whether the given CharSequence contains only digits.
*/
public static boolean isDigitsOnly(CharSequence str) {
final int len = str.length();
for (int i = 0; i < len; i++) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
}
I think it should be returning false in that case.
I have seen the issue on Android 2.3.3