last day (14 days later) » 

3:29 PM
1
A: How can I show a button when all views are viewed in viewpager?

StoneBirdIn your onPageSelected, do the following if(isViewed) { save_button.setVisibility(Button.VISIBLE); } if (position == numberOfPages.size()-1) { isViewed = true; save_button.setVisibility(Button.VISIBLE); } Note the above are two seperate if statements. Make your isViewed global and defau...

 
Thanks for answering, StoneBird. I tried your solution but with @Pr39y's answer of making the isViewed an array equal to numberOfPages.size() and it only makes the last save button show and not all previous ones after the last one is shown.
I've edited my post to show what I have attempted. Thanks a lot again! :D
 
@KalaJ no, don't use array in this case. This is because you want isViewed to be shared across all pages, so that once it's flipped to true, it will be true for all of your pages.
 
Okay but here's my problem with your current approach. Right now if the view is open/seen, it automatically adds the save button. I want it so that the user has to see ALL views first before showing the save button permanently. Right now, it shows the save button immediately when the view starts.
 
@KalaJ that's why I say you should initialize isViewed to false, and only change it to true in the last page.
 
Yup, that's what I did but eh..
 
3:29 PM
@KalaJ pastebin plz
 
pastebin.com/ijFxQR7w. I stripped out code to reveal only the necessary details. Let me know if you have any questions about anything. Thank you so much
 
@KalaJ did you initialize visibility in your xml? Anyway see the edit
 
Well right now, I have two pages in my viewpager. Both pages have the save button immediately. I didn't have to access the last page first before seeing the save button.
btw, no I didn't initialize visibility in xml
 
@KalaJ you should set your button visibility in xml to gone so that your button is initialized as hidden.
 
If I set the button visibility to invisible, the button is initialized as hidden but it doesn't come back on the screen after I go to my last page and back to the first page.
 
3:29 PM
@KalaJ see edit. It should be working. I just tried a brief example...
 
I'm sorry it still doesn't work for me correctly.
That's okay, it's not really an important feature :(
 

last day (14 days later) »