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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:47:38+00:00 2026-05-23T18:47:38+00:00

I am new to android programming but have a pretty strong Java background. I

  • 0

I am new to android programming but have a pretty strong Java background. I am working on creating a fairly simple game that involves progressing through various short “levels”, and the whole thing is timed, the objective being to get the fastest time possible. I put levels in quotations because they are very short, and mainly involve doing a few simple tasks (i.e. clicking a button) before progressing to the next one. As a result instead of creating a different activity for each level, I decided to keep everything within one activity and when a user completes all of the tasks for one level, a different layout is set-up using the setContentView() method. My problem is that every time I switch layouts, I need to reset my pointers to the buttons using findViewById() even though they are named the same. If someone could explain why I need to do this that would be very helpful? Also, as I am fairly new to android, perhaps I am not going about this in the most efficient way? Any suggestions would be welcome and appreciated.

Also I think this is probably related, but I have a chronometer that I want to be persistent across the layouts? I have seen in other questions that this is not possible across activities, but I wanted to check on the case of across layouts.

Thank you in advance for your help.

Edit: Thank you ania, viewflipper looks like the perfect solution

Edit: So after some experimenting with the ViewFlipper I have decided to use it for my project. While it does not solve the issue of having to re-add the buttons with every new level(this I solved by giving each button a distinct name, even across all layouts), it did give me some nice animation effects as well as the convenience of using showNext and showPrevious methods.

  • 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-23T18:47:39+00:00Added an answer on May 23, 2026 at 6:47 pm

    Did you try ViewFlipper? It seems like perfect solution in this case.

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

Sidebar

Related Questions

I'm fairly new to Android programming and to Java in general, but I have
I am new at android development and java programming, but I have decided to
I am new to Java programming / Android development - but I have been
I am completely new to android, and pretty much a Java newb. I have
I have a project that is just using Android 1.5 for programming, but with
I have just began opengl programming in android and i am fairly new to
I'm new to Android and Java programming and I've manage to create a simple
I'm new to Java programming, I am programming Java 1.6 with Android. I have
I'm very new to programming in Android, but have been struggling all day with
I'm new to android programming, but one thing that I can't seem to get

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.