I am trying to add next/back buttons on NoteEdit activity (Notepad Exercise 3 code).
I ve created options menu and added two buttons there. In onOptionsItemSelected
I ve written the following:
case R.id.movie_menu_previous:
Intent i = new Intent(this, MovieView.class);
i.putExtra(MoviesDbAdapter.KEY_ROWID, mRowId+1);
startActivity(i);
return true;
case R.id.movie_menu_next:
Intent i = new Intent(this, MovieView.class);
i.putExtra(MoviesDbAdapter.KEY_ROWID, mRowId+1);
startActivity(i);
return true;
But the problem is that number of rows is limited. So, if user presses Next on the last row, I am getting FC.
How can I know that this is first row? last row? (I ve modified the initial code and now in the database I have many records, but not all of them are shown in ListView
)
And, will not it be better to change logic of populateFields
function and call it instead of creation new activity?