Skip to content

SpaceTech

Exploration of Information, Communication and Technology

  • Home
  • Blog
  • Projects
    • Resx Builder
  • About
  • LinkedIn
  • Github

Android Get Focused View From ViewPager

August 18, 2012June 2, 2021 Bjarne

To get the focused view in a Android ViewPager call the OnPageSelected().

private int focused = 0;
private class MyPageChangeListener extends ViewPager.SimpleOnPageChangeListener {
    @Override
    public void onPageSelected(int position) {
        focused = position;
    }
}

Take a look at this interesting blogpost about ViewPager

Posted in TechnologyTagged Android, focused, Tips and Tricks, viewpager

About

Hey! I'm an engineer from Denmark. This is my engineering diary. I enjoy creating things, whether that be websites, plugins, mobile apps. I'm currently playing around in an engineering department where I work on a wide variety of interesting and meaningful projects on a daily basis.


  • Key Takeaways Chapter 3: Working with the Xtend Programming Language of Implementing Domain-Specific Languages with Xtext and Xtend – Second Edition
  • Key Takeaways Chapter 2 of Implementing Domain-Specific Languages with Xtext and Xtend – Second Edition
  • Key Takeaways Chapter 1 of Implementing Domain-Specific Languages with Xtext and Xtend – Second Edition
  • Xtext The rule ‘Primary’ may be consumed without object instantiation
  • VS Code disable blame text and you change x ago

Copyright ©SpaceTech

Clean Theme by WPVKP