This is a very basic java question, I have an array of strings
String[] navTitles = new String[] {Home, HR, company, joiner, next};
These title
try below code:-
Error occur because index value reach more than the index.
private void displayView(int position)
{
Fragment fragment = null;
position = position % length; //length of your array
if(position==0)
{
fragment = new HomeFragment(SPHostUrl,encodedAccountName,deviceAuthKey,usersname,avatarUrl, fullName,getApplicationContext(),myFinalNewsList);
}
else
{
String myPosition = null;
myPosition = navDrawerItems.get(position).getTitle(); //Line 600
companyNewsList = Lists.newArrayList(Collections2.filter(myFinalNewsList, new ArticleFilter(myPosition)));
fragment = new HomeFragment(SPHostUrl,encodedAccountName,deviceAuthKey,usersname,avatarUrl, fullName,getApplicationContext(),companyNewsList);
}
}
above code works fine at my end because it makes position under array length .