How to add next/back buttons to Notepad 3 on android? -


I'm trying to add the next / back button on the edit activity (code). I have created the options menu and added two buttons in the I onOptionsItemSelected I have written the following:

  Case R.id.movie_menu_previous: intent I = new intent (this , Movie scenes). I.putext (movies dbadater.cEY_ROWID, mRowId + 1); StartActivity (i); Back true; Case R.id.movie_menu_next: Intent I = New Intent (This, Movie View.); I.putext (movies dbadater.cEY_ROWID, mRowId + 1); StartActivity (i); Back true;   

But the problem is that the number of rows is limited. So, if the user moves on the last line, then I'm getting FC. How do I know that this is the first line? The last line? (I have modified the initial code and now I have a lot of records in the database, but not all of them are shown in ListView ) and, better in changing the populateFields logic Will not the function and call it instead of creating a new activity?

I have overridden the Populatefields function and it includes the following:

  mRowId = mDbHelper.getNextRecord (1, mRowId);   

And here is the code for getNextRecord function:

  public long getNextRecord (int next, long line id) {long nextRowId = 0; Cursor mCursor = mDb.query (DATABASE_TABLE, new string [] {KEY_ROWID, KEY_TITLE}, KEY_TITLE + "! = \" \ "", Blank, empty, empty, empty); If (mCursor.moveToFirst ()) {do (if mcursor.getLong (mCursor.getColumnIndexOrThrow (KEY_ROWID)) == rowId {if (! MCursor.move (next)) {// First (-1) or final position if (MCursor.getPosition () == -1) {mCursor.moveToLast (); } And {mCursor.moveToFirst (); }} NextRowId = mCursor.getLong (mCursor.getColumnIndexOrThrow (KEY_ROWID)); break; }} While (mcursor.moveToNext ()); } MCursor.close (); Return the nextRowId; }    

Comments