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 8450029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:51:43+00:00 2026-06-10T10:51:43+00:00

Right now I have my ApplicationActivity , this activity is responsible for managing multiple

  • 0

Right now I have my ApplicationActivity, this activity is responsible for managing multiple views (GLSurfaceViews). Can / Should I have all the views set the renderer to a “global” renderer?

Code:

public class ApplicationActivity extends Activity 
{
    private static final String TAG = ApplicationActivity.class.getSimpleName();

    private final Stack<Screen> screens = new Stack<Screen>();
    private GlRenderer glRenderer;

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);

            Log.d(TAG, "Main Activity Created");

        setupGraphics();

        ChangeScreen(new MainMenu(this, glRenderer)); //Creating a new Screen sets the renderer
    }

    private void setupGraphics()
    {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,     WindowManager.LayoutParams.FLAG_FULLSCREEN);

        glRenderer = new GlRenderer(this);
    }


    public void Draw() //Is called by the glRenderer onDrawFrame() { mainActivity.Draw() } 
    {

    }
}

Its the same activity switching between GLSurfaceViews and by my knowledge I believe that the method setRenderer sets the view renderer and then starts the rendering thread (creating a new thread) but I don’t want to recreate the thread every time I switch between views – may create potential problems.

So in the end I want a Renderer class just to keep graphics sepreate from business logic and such but, I don’t know if using one Renderer is even possible, without setting the thread again?

  • 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-10T10:51:45+00:00Added an answer on June 10, 2026 at 10:51 am

    You can only use Multiple Views with the same Renderer only if you properly switch out between them with GLSurfaceView.onPause() / .onResume();

    My specific case:

    @Override
    protected void onPause() //Overrides onPause from Activity
    {
        surfaceViews.peek().onPause();
        super.onPause();
    }
    

    So everytime the activity pauses I would have to pause the current View. And if the Activity resumes then resume the View also.

    I also have a method called SetView which will either (pause and remove then change to another View) or (pause and then change to another View) this is accomplished using a Stack

    public void SetView(View screen)
    {   
        if (!screens.empty())
        {
            screens.peek().onPause();
            screens.pop();
        }
    
        screens.push(screen);
        setContentView(screens.peek());
    }
    

    Of course though because we are using Views instead of Activities now we must Override the onBackPressed() to go back to previous Views.

    @Override
    public void onBackPressed() 
    {       
        if (screens.size() == 1)
            super.onBackPressed();
        else
        {
            screens.pop();
            setContentView(screens.peek());
            screens.peek().onResume();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I have this SQL query which is valid but always times out:
right now i have this <script type='text/javascript'> $(#beau).click(function(){ $(#beau).animate({margin-Top: 738px}, fast); }); </script> and
Right now I have the following query: User.find(:all, :conditions => [guest = ? AND
Right now I have this layout: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent
Right now we have a dll file that contains all the database calls and
Right now I have two regular expressions that does this: Regex-1 = (\\{(\\w+)\\}); Regex-2
Right now I have views with layout_weight inside another view that also has the
Right now I have this: echo <a href='misc/removeWallComment.php?id= . $displayWall['id'] . &uID . $displayWall['uID']
Right now I have something in php that looks like this: $count = array_count_values($result);
Good day! I right now have a function the drags an element from a

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.