Q:

How to fetch one by one row from sqlite database and show in EditText Box

I went through so many links and honestly made effort to get my answer but still messed. (May be its duplicate question)  .I inserted few rows in Sqlitedatabase successfully. I need to show every row in EditText on Next and Previous button.
below is my code
public List<Contact> getAllContacts() {
        List<Contact> contactList = new ArrayList<Contact>();
        // Select All Query
        String selectQuery = "SELECT  * FROM " + TABLE_CONTACTS;
        SQLiteDatabase db = this.getWritableDatabase();
        cursor = db.rawQuery(selectQuery, null);
      {
            do{
            Contact contact = new Contact();
            contact.setID(Integer.parseInt(cursor.getString(0)));
            contact.setName(cursor.getString(1));
            contact.setPhoneNumber(cursor.getString(2));
             contactList.add(contact);
             }while(cursor.moveToNext());
            cursor.moveToFirst();
           cursor.close();
        }
         return contactList;
    }

A:

Cursors have a specific behavior, they start before the first result.
So you have to moveToFirst before doing anything :
public List<Contact> getAllContacts() {
    List<Contact> contactList = new ArrayList<Contact>();
    // Select All Query
    String selectQuery = "SELECT  * FROM " + TABLE_CONTACTS;
    SQLiteDatabase db = this.getWritableDatabase();
    cursor = db.rawQuery(selectQuery, null);
    {
        if (cursor.moveToFirst()) {
            do {
                Contact contact = new Contact();
                contact.setID(Integer.parseInt(cursor.getString(0)));
                contact.setName(cursor.getString(1));
                contact.setPhoneNumber(cursor.getString(2));
                contactList.add(contact);
            } while (cursor.moveToNext());
        }
        cursor.close();
    }
    return contactList;
}

Or you can just loop on moveToNext so at the first iteration, the cursor will point to the first result :
public List<Contact> getAllContacts() {
    List<Contact> contactList = new ArrayList<Contact>();
    // Select All Query
    String selectQuery = "SELECT  * FROM " + TABLE_CONTACTS;
    SQLiteDatabase db = this.getWritableDatabase();
    cursor = db.rawQuery(selectQuery, null);
    {
        while (cursor.moveToNext()) {
            Contact contact = new Contact();
            contact.setID(Integer.parseInt(cursor.getString(0)));
            contact.setName(cursor.getString(1));
            contact.setPhoneNumber(cursor.getString(2));
            contactList.add(contact);
        }
        cursor.close();
    }
    return contactList;
}

Your code:
button clicactivity is 
show.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
         List<Contact> contacts = db.getAllContacts();       
            for (Contact cn : contacts)
            {
                String log = "Id: "+cn.getID()+" ,Name: " + cn.getName() + " ,Phone: " + cn.getPhoneNumber();
                edit_name.setText(cn.getName());
                edit_phon.setText(cn.getPhoneNumber());
            }

         }
   });

Ok. So your problem here is what I though.
When you click on the button, the loop here put the name (getName()) in the EditText for each contact you got from database.
This iteration does this (if you have two contacts):

It gets the first contact and puts its name into the EditText
The loop goes on and gets the second contact and puts its name into the same EditText

At the end of this loop, you only have last contact information displayed.
You can add a Log.d("CONTACT", cn.getName()); to see it iterate over each contact.
So:
Something that should work is to keep track of the latest displayed index.
int index = 0;

@Override
public void onClick(View v) {
    if (v.getId() == R.id.previous) { // android:id="@+id/previous" on the "Previous" button
        index--;
    }
    else if (v.getId() == R.id.next) { // android:id="@+id/next" on the "Next" button
        index++;
    }
    List<Contact> contacts = getAllContacts();
    // Prevent out of bounds
    index = Math.min(Math.max(index, 0), contacts.size() - 1);
    // Fill `EditText`s with contact data
    Contact contact = contacts.get(index);
    edit_name.setText(cn.getName());
    edit_phon.setText(cn.getPhoneNumber());
}

Then, when you click on the "Previous" button, it displays the previous (or first if there is no previous) contact data. And when you click on the "Next" button, it displays the next (or last if there is no next) contact data.
Note on Math uses:
If I have 2 contacts, available indexes are 0 and 1.
index = Math.max(index, 0) => So it is never < 0 (0, the first index)
                  V
index = Math.min(index, contacts.size() - 1) => So it is never > (2 - 1) = 1 (1, the last index)

This prevents OutOfBoundsException thrown when trying to get element in a List at an index in which there is no element.

