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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:53:13+00:00 2026-06-17T23:53:13+00:00

I’ve been successfully using animation in my project, with TranslateAnimation objects, but when I

  • 0

I’ve been successfully using animation in my project, with TranslateAnimation objects, but when I return to the activity whose views have been animated, they redraw at their default positions.

So, for example,

  1. I create an activity called HomeActivity. The content draws as defined in the XML. A View (myTextView) might appear at position0.

  2. I can use a TranslateAnimation to move myTextView to position1.

  3. I can click a button (or whatever) to start, say, MenuActivity.

  4. I exit MenuActivity and resume HomeActivity.

(What I’m seeing)
myTextView shows up at position0 again.

(What I’d like to see)
myTextView is drawn at position1.

Here’s how I perform the animation.

TextView myTextview = (TextView)findViewById(R.id.mytextview);

private void animate()
{
Animation anim = new TranslateAnimation(0, displacementX, 0, displacementY);
anim.setDuration(200);
anim.setAnimationListener(this); // This activity implements AnimationListener
anim.setFillEnabled(true);
anim.setFillAfter(true);
myTextview.startAnimation(anim);
}

@Override
public void onAnimationEnd( Animation animation )
{
 myTextview.clearAnimation();
}

Are there any flags I should set, maybe in the above procedure, onPause or in onAnimationEnd, that would cause the Views to retain their post-animated state? Or do I need to save their locations before starting the new activity and shift them in onResume? Or is there another way altogether?

Please let me know if you need any clarification.

Forgot to specify, minimum SDK is 2.2 (API 8).

Thanks in advance.

  • 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-17T23:53:14+00:00Added an answer on June 17, 2026 at 11:53 pm

    First of all, don’t use TranslateAnimation for this, try using ObjectAnimator as it actually move the views. When using TranslateAnimation the views never change place, it only seems so. If this is not enough, try saving the view’s location in onSaveInstanceState and in onRestoreInstanceState you can position the view to this locations.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I have been unable to fix a problem with Java Unicode and encoding. The
I have thousands of HTML files to process using Groovy/Java and I need to
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.