dimanche 15 juillet 2018

Android if statement doesnt work on setOnClickListener

I have create a walkthrough android studio screen of 3 slides and I need that when I push the button mNextBtn, at the third slide, it change to another Java class. As you can see in the code below I've used an if statement but it doesn't work because when I run and I push the mButtonBtn button the app stop, how can I fix it?

mNextBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mDots.length == 3){ Intent intent= new Intent(getApplicationContext(), Login.class); startActivity(intent); }else { mSlideViewPager.setCurrentItem(mCurrentpage + 1); } } });

Aucun commentaire:

Enregistrer un commentaire