I made a slide banner that displays 3 images in Android with ViewPager, but now I need that it changes every 5 seconds between the 3 images.

I tried with a thread but I don't know how to make the change when I reach the 5 seconds. 

Can anyone help me please?

This is my main

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

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();

    viewPager = (ViewPager) findViewById(R.id.viewPagerMain);
    adapter = new ViewPagerAdapter(MainActivity.this,imagesArray);
    viewPager.setAdapter(adapter);

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    TextView tvEventos = (TextView) findViewById(R.id.eventos);
    tvEventos.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(MainActivity.this, EventActivity.class);
            startActivity(i);
        }
    });

    TextView tvPromociones = (TextView) findViewById(R.id.promociones);
    tvPromociones.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(MainActivity.this, EventActivity.class);
            startActivity(i);
        }
    });
    TextView tvDirectory = (TextView) findViewById(R.id.directorio);
    tvDirectory.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(MainActivity.this, DirectoryActivity.class);
            startActivity(i);
        }
    });

    TextView tvPinatas = (TextView) findViewById(R.id.pinatas);
    tvPinatas.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(MainActivity.this, CumpleaniosActivity.class);
            startActivity(i);
        }
    });
    TextView tvBebes = (TextView) findViewById(R.id.bebes);
    tvBebes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(MainActivity.this, BebesActivity.class);
            startActivity(i);
        }
    });
}

```

this is my ViewPagerAdapter

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

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();

    viewPager = (ViewPager) findViewById(R.id.viewPagerMain);
    adapter = new ViewPagerAdapter(MainActivity.this,imagesArray);
    viewPager.setAdapter(adapter);

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    TextView tvEventos = (TextView) findViewById(R.id.eventos);
    tvEventos.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(MainActivity.this, EventActivity.class);
            startActivity(i);
        }
    });

    TextView tvPromociones = (TextView) findViewById(R.id.promociones);
    tvPromociones.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(MainActivity.this, EventActivity.class);
            startActivity(i);
        }
    });
    TextView tvDirectory = (TextView) findViewById(R.id.directorio);
    tvDirectory.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(MainActivity.this, DirectoryActivity.class);
            startActivity(i);
        }
    });

    TextView tvPinatas = (TextView) findViewById(R.id.pinatas);
    tvPinatas.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(MainActivity.this, CumpleaniosActivity.class);
            startActivity(i);
        }
    });
    TextView tvBebes = (TextView) findViewById(R.id.bebes);
    tvBebes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(MainActivity.this, BebesActivity.class);
            startActivity(i);
        }
    });
}

```

I dont know where to create the Thread and how to make the change of the position.