I have an app with vertical slider to switch between different smileys (from happier to saddest) My problem is i don't know how I can get currentItem of my ViewPager (When User is on a specific smiley)
I've tried
verticalViewPager.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
mPreferences.edit().putInt(PREF_KEY_CURRENT_SMILEY,verticalViewPager.getCurrentItem()).apply();
return false;
}
});
And in the other activity (where i have to store the current smiley selected) :
currentSmileyInt = mPreferences.getInt(PREF_KEY_CURRENT_SMILEY,-50);
currentSmileyString = Integer.toString(currentSmileyInt);
currentSmileyTextView.setText(currentSmileyString);
If i'm good the textview on the other activity should display an int between 1-6. (different positions), and if i'm not good it display -50.
I don't understand what i'm doing wrong, as i set verticalVP.setCurrentItem(3) the corresponding smiley is displayed ... Thank you in advance and sorry for my bad english :)