+ 1

how i can link the CircularPageIndicator with next and back buttons

import android.annotation.SuppressLint; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.view.View; import android.view.Window; import android.widget.Button; import android.widget.TextView; @SuppressLint("NewApi") public class Main2Activity extends FragmentActivity { private ViewPager viewPager; private TabsPagerAdapter mAdapter; TextView skip; Button bt1,bt2,bt3,bt4; Button back; Button next; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_main2); back=(Button) findViewById(R.id.back); next=(Button) findViewById(R.id.next); bt1=(Button) findViewById(R.id.btn1); bt2=(Button) findViewById(R.id.btn2); bt3=(Button) findViewById(R.id.btn3); viewPager = (ViewPager) findViewById(R.id.pager); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { btnAction(position); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); } private void btnAction(int action){ switch(action){ case 0: setButton(bt2,4,15,R.drawable.circle2); setButton(bt1,4,15,R.drawable.circle); setButton(bt3,4,15,R.drawable.circle); break; case 1: setButton(bt1,4,15,R.drawable.circle2); setBut

24th Apr 2018, 8:31 PM
Achabi Ismail
Achabi Ismail - avatar
1 Resposta
+ 2
1. You can use android lib and set pager indicator to view pager. com.viewpagerindicator.CirclePageIndicator; indicator.setViewPager(mPager); 2. OnButtonClick() mPager.setCurrentItem(1, true);
25th Apr 2018, 7:28 AM
Parveen D
Parveen D - avatar