[Android][Beta] Add validation for get navigation item

If the input parameter is out of scope, it will cause crash.
Add validation here to avoid crash.

BUG=XWALK-1874
(cherry picked from commit 4b79f46)