Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8190153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:31:34+00:00 2026-06-07T03:31:34+00:00

Basically what the title says, My application consists primarily of a ViewPager which uses

  • 0

Basically what the title says,

My application consists primarily of a ViewPager which uses a FragmentStatePagerAdapter

The problem occurs when I add a series of SurfaceViews to the FragmentStatePagerAdapter.
Just for testing purposes I did not subclass the SurfaceViews in any way.
When I navigate a few pages in, hit “home,” and then return to the activity, the entire device freezes for a second or two before rendering anything. I can launch and finish() the app several times in the time it takes for it to resume after being pulled off of the backstack. I know that the application is running because several AsyncTasks have nearly finished by the time the first screendraw finally occurs. I know that these AsyncTasks do not cause the problem because I have removed them to no effect.

When I change the SurfaceViews to Views the problem vanishes entirely.

This problem occurs when I use my actual SurfaceViews (which are non-negotiable for my project) as well. This problem also occurs on multiple devices.

At this point I think the fault lies squarely on the ViewPager, but I don’t know what to do about it because I need that interface component.

Any help would be greatly appreciated!

EDIT:

To clarify, the SurfaceViews/Views represent the View of the Fragment which was added to the FragmentStatePagerAdapter.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T03:31:37+00:00Added an answer on June 7, 2026 at 3:31 am

    Found the solution for any future googlers!

    Heres how I did it:

    In my fragment I instantiated mySurfaceView in onCreate()

    Then I attached a dummy layout (LinearLayout) to the actual view during onCreateView()

    Then in onResume() I cleared the dummy layout with removeAllViews() and then called addView(mySurfaceView)

    This seems to allow the ViewPager to build its layout quickly and then the SurfaceView is just popped in before the user actually needs to see anything!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically what the title says. I created a new MVC application. I'm trying to
Basically the problem is exactly what the title says. My app works smoothly on
The title basically says it all. Suppose I have an element which I want
Basically, my problem is exactly what it says in the title. When I try
Basically what the title says, I want to get the URL and HTTP Verb
so basically like the title says is there a way to use NSSortDescriptor to
...basically exactly what the title says. NetworkStream.Length is not implemented. What's an alternative? I'm
The title pretty much says it all, but basically I have a main parent
Sorry for the confusing title, but it basically says it all. Here's the structures
The title basically says it all. I have a hexadecimal string representing a private

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.