[Android] 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-1863
Merge pull request #2044 from kurli/validate_history_index

[Android] Add validation for get navigation item