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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:43:27+00:00 2026-05-30T05:43:27+00:00

I am designing a media player with a custom layout. I want the interface

  • 0

I am designing a media player with a custom layout. I want the interface to disappear after 16s of inactivity. It should reappear if the user touches the screen. The code snippet is given below:

 public void showhideControllers(int n) {
    if (n == 1) {
        /* make layout invisible */

        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            public void run() {
                volumeBar.setVisibility(View.INVISIBLE);
                audioControllView.setVisibility(View.INVISIBLE);
                topBar.setVisibility(View.INVISIBLE);
            }
        }, 16000);

    } else {
        /* make layout visible */           
        volumeBar.setVisibility(View.VISIBLE);
        topBar.setVisibility(View.VISIBLE);
        audioControllView.setVisibility(View.VISIBLE);

        showhideControllers(1);
    }

}

    @Override
public void onUserInteraction() {
    super.onUserInteraction();
    showhideControllers(2);
}

Inside the onCreate(), I am starting the timer by calling showhideControllers(1);.
Now, when I click on the screen the layout reappears and the timer is reset. But if I randomly go on clicking the screen the timer is not reset after every click and the layout disappears after 16s.
Can you tell me what am I doing wrong ?

  • 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-05-30T05:43:29+00:00Added an answer on May 30, 2026 at 5:43 am

    Sorry for late response. But here is the solution. I was having similar issue. So I have made following changes in your code, please try this and let me know if it helps you.

    private Runnable hideControllerThread = new Runnable() {
    
        public void run() {
                volumeBar.setVisibility(View.GONE);
                audioControllView.setVisibility(View.GONE);
                topBar.setVisibility(View.GONE);
        }
    };
    
    
    public void hideControllers() {
            hidehandler.postDelayed(hideControllerThread, 15000);
    }
    
    public void showControllers() {
            volumeBar.setVisibility(View.VISIBLE);
            topBar.setVisibility(View.VISIBLE);
            audioControllView.setVisibility(View.VISIBLE);
            hidehandler.removeCallbacks(hideControllerThread);
            hideControllers();
    }
    
    @Override
    public void onUserInteraction() {
            super.onUserInteraction();
    
            if (audioControllView.getVisibility() == View.VISIBLE) {
                hidehandler.removeCallbacks(hideControllerThread);
                hideControllers();
            } else {
                showControllers();
            }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When designing an internation registration form how should I be asking for a user's
My mate and I are designing/implementing a web based media application. It will provide
When designing a class, should logic to maintain valid state be incorporated in the
I am designing my web project by Wicket. There I want to add web
I'm looking into designing a media server application for a school project and was
I am designing a small website that I want to be able to browse
When designing for layout and styling with CSS, it might be useful to add
While designing a table my colleague here says that I should avoid identity column
When designing user table what would be the must have fields from the security/user
I'm in startup of designing a client/server audio system which can stream audio arbitrarily

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.