An Error occurs when I was making a code to create a show list by ListView{in content_main.xml} like contact view. plz help me. : **I was making a code to create a show list by ListView{in content_main.xml} like contact view.
 I build a database in the (SQLite Expert Professional) with a table(name: "contact") that was contained a few name and family and numbers, with ID,NAME,fAMILY and PHONE NUMBER columns.
ID was unique, auto increment and primary key...other were Text except number that was CHAR.
 then I calling them to my ListView as you see in below.(before it I made a row_list activity to made my listview , custom) but there was an Error and i can't find it.
{I could find my database.db file with that's table in the source data files that means my mistake wasn't from creating database.} 
plz help me.I wanna learn android (as fast as i can) to get a JOB and I need it..**

*Errors.Android Monitor.Logcat*

    09-08 05:27:32.005 5692-5692/? W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x94c4fb20)
    09-08 05:27:32.005 5692-5692/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: mizco.phonebook, PID: 5692
    java.lang.RuntimeException: Unable to start activity ComponentInfo{mizco.phonebook/mizco.phonebook.Main}: android.database
    .CursorIndexOutOfBoundsException: Index 5 requested, with a size of 5
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2193)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2243)
    at android.app.ActivityThread.access$800(ActivityThread.java:135)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5019)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: android.database.CursorIndexOutOfBoundsException: Index 5 requested, with a size of 5
    at android.database.AbstractCursor.checkPosition(AbstractCursor.java:426)
    at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
    at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
    at mizco.phonebook.database.getfulllist(database.java:97)
    at mizco.phonebook.Main.onCreate(Main.java:36)
    at android.app.Activity.performCreate(Activity.java:5231)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2157)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2243)
    at android.app.ActivityThread.access$800(ActivityThread.java:135)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5019)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
    at dalvik.system.NativeStart.main(Native Method)

**Main.java**

    package mizco.phonebook;

    import android.os.Bundle;
    import android.support.annotation.NonNull;
    import android.support.design.widget.FloatingActionButton;
    import android.support.v7.app.AppCompatActivity;
    import android.support.v7.widget.Toolbar;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.ArrayAdapter;
    import android.widget.ListView;
    import android.widget.TextView;
    
    public class Main extends AppCompatActivity {
        private database db;
        private String [][] res ;
    
        private ListView list;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        list = (ListView) findViewById(R.id.main_list);

        db = new database(this);
        db.startusing();

        db.open();
        res = db.getfulllist();
        db.close();


        list.setAdapter(new AA());


        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
            }
        });

    }


    class AA extends ArrayAdapter<String>{

        public AA() {

            super(Main.this, R.layout.row_list, res[0]);
        }
        @NonNull
        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {

            LayoutInflater in = getLayoutInflater();
            View row = in.inflate(R.layout.row_list,parent,false);

            TextView name = (TextView) row.findViewById(R.id.row_name);
            TextView number = (TextView) row.findViewById(R.id.row_number);

            name.setText(res[0][position]+" "+res[1][position]);
            number.setText(res[2][position]);
            return row;
        }
    }

    }

**Class : database.java**

    package mizco.phonebook;

    import android.content.Context;
    import android.database.Cursor;
    import android.database.sqlite.SQLiteDatabase;
    import android.database.sqlite.SQLiteOpenHelper;
    
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    
    /**
     * Created by Mahdi on 9/2/2017.
     */
    
    public class database extends SQLiteOpenHelper {

    public static String dbname= "database";
    public static String dbpath="";
    private Context mctxt;

    private SQLiteDatabase mydb;


    public database(Context context) {
        super(context, dbname, null, 1);
        mctxt = context;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int i, int i1) {

    }

    private boolean existdatabase(){
        File m312 = new File(dbpath+dbname);

            return m312.exists();
    }


    private void copydatabase(){
        try {
            InputStream IS = mctxt.getAssets().open(dbname);
            OutputStream OS = new FileOutputStream(dbpath+dbname);


            byte[] buffer = new byte[1024];
            int length;

            while ((length = IS.read(buffer))>0){
             OS.write(buffer,0,length);
            }
            OS.flush();
            OS.close();
            IS.close();

        } catch (Exception e) {
        }
    }

    public void open(){
        mydb = SQLiteDatabase.openDatabase(dbpath+dbname, null, SQLiteDatabase.OPEN_READWRITE);
    }

    public void close(){
        mydb.close();
    }




    public void startusing () {
        dbpath = mctxt.getFilesDir().getParent() + "/databases/";
        if (!existdatabase()) {
            this.getWritableDatabase();
            copydatabase();
        }
    }

    public String[][] getfulllist(){


        Cursor cu = mydb.rawQuery("select * from Contact",null);

        String [][] r = new String[3][cu.getCount()];
        for (int i= 0;i<=cu.getCount();i++){
            cu.moveToPosition(i);

            r[0][i]=cu.getString(1);
            r[1][i]=cu.getString(2);
            r[2][i]=cu.getString(3);
        }

        return r;
    }

    }

