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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:14:40+00:00 2026-05-13T20:14:40+00:00

I need help coming up with a way of executing the following sequence using

  • 0

I need help coming up with a way of executing the following sequence using some type of view or layout combination in Android:

I have 3 image objects… say object A, B, and C…

[all objects invisible and layered, one on top of the other… A/B/C, like in a RelativeLayout]–>[fade in object A]–>[display A for 200ms]–>[simultaneously fade out object A and fade in object B]–>[display object B for 200ms]–>[simultaneously fade out object B and fade in object C]–>[object C remains on the screen indefinitely]

I have tried every combination of Threads, AsyncTasks, Handlers, custom layouts, AnimationListeners, etc. but everything I’ve tried has failed.

If only the ViewSwitcher could take more than 2 views… Please help.

Ryan

  • 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-13T20:14:41+00:00Added an answer on May 13, 2026 at 8:14 pm

    The main thing about threads is that they are supposed to allow you to do parallel tasks, but the problem is that they don’t guarantee “how parallel” those tasks will actually look when they’re executed. Since the scheduler decides which thread to execute at any given time you are not guaranteed that your images will be properly faded in/out. While you can do this task with multithreaded code, I don’t think it’s a good candidate.

    The best thing to do is to update both images (fade in/fade out) on every frame of the animation. A signals when it begins to fade out and B picks up that signal, then it starts to fade in. You will get a smooth transition since both A and B get updated on each frame, and you will not have any of the uncertainty of the threads. Do the same thing for B and C.

    UPDATE: You caught me! 🙂
    I thought you’d let me get away with just giving you the general information, but now that you have me cornered I had no choice but to google stuff :). OK, so the android library has some animation classes, the library also offers you a way in which you can actually perform frame-by-frame animation.

    I’d give you a simple hack for this, but I’m sure there are better ways to do it:
    The animations take several images which should be displayed over a certain duration, so all you have to do is alternate the images.

    <!-- Animation frames are AfadeOut01.png to AfadeOut03.png and BfadeIn01.png to BfadeIn03.png files inside the res/drawable/ folder,  -->
     <animation-list android:id="selected" android:oneshot="true">
        <item android:drawable="@drawable/AfadeOut01" android:duration="50" />
        <item android:drawable="@drawable/BfadeIn01" android:duration="50" />
        <item android:drawable="@drawable/AfadeOut02" android:duration="50" />
        <item android:drawable="@drawable/BfadeIn02" android:duration="50" />
        <item android:drawable="@drawable/AfadeOut03" android:duration="50" />
        <item android:drawable="@drawable/BfadeIn03" android:duration="50" />
     </animation-list>
    

    You have to load the xml animation and display the animation, do something like this:

     // Load the ImageView that will host the animation and
     // set its background to our AnimationDrawable XML resource.
     ImageView img = (ImageView)findViewById(/*resourceImageID e.g. AfadeOut03*/);
     img.setBackgroundResource(/*backgroundResource*/);
    
     // note that this loads the resource from an XML file, but
     // instead of getting the resource from file you can generate
     // it from a single image by performing the required modifications
     // of the image and storing them in a resource.
    
     // Get the background, which has been compiled to an AnimationDrawable object.
     AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();
    
     // Start the animation
     frameAnimation.setOneShot(true);// don't loop if not set in XML
     frameAnimation.start();
    

    OK, so I know that was a dirty hack, but it should do what you want :). If this is too simple and uncool for you, then you could go the original route and try to figure out how to display your images frame by frame, etc.

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

Sidebar

Related Questions

I need some help here. I am using razor view in MVC3. I have
So I need some help coming up with a way to find a Minimum
I have one jQuery code and need some help from u guys to improve
Need your help in over coming the following issues. i need to send opt-in
I'm hoping to get some help coming up with a faster way to do
Core Question I need help coming up with a concept to achieve my goal.
Need help with a query that I wrote: I have three tables Company id
Need help writing a script downloads data from google insight using c# this is
need help/guide for sql select query, I have 2 table stock and stock_history, in
I need help on coming up with a strategy to handle object ids in

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.