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

  • SEARCH
  • Home
  • 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 8872869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:19:26+00:00 2026-06-14T18:19:26+00:00

I have two activities. Activity 1 and activity 2. I have given animation when

  • 0

I have two activities. Activity 1 and activity 2. I have given animation when I call activity 2 from activity 1.

The kind of animation that I have given is that activity 1 should move to right side and activity 2 should come from left side to right side and take the position of activity 1 (->activity2->activity1->). I am successfully able to do that. I am finishing activity 1 as soon as I call activity 2.

Now I am trying to call activity 1 from activity 2. I want activity 2 to move to left side and activity 1 should come from right side to left side and take the position of activity 2 (<-activity 2<-activity 1<-). I am finishing activity 2 when I call activity 1. The problem is that, when I try to do that the activity 1 appears two times.

The problem is like this, as soon as I press on the button for calling activity 1 from activity 2, activity 1 appears suddenly without any animation. Then activity 1 slides away and activity 1 comes again.

Here is the xml code I use for moving from activity 1 to activity 2:

<?xml version="1.0" encoding="utf-8"?>
 <set xmlns:android="http://schemas.android.com/apk/res/android"
         android:shareInterpolator="false">
        <translate android:fromXDelta="-100%" android:toXDelta="0%"
          android:fromYDelta="0%" android:toYDelta="0%"
         android:duration="700"/>
</set>

Here is the xml code I use for moving from activity 2 to activity 1:

 <set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false" >

   <translate android:fromXDelta="0%" android:toXDelta="-100%"
          android:fromYDelta="0%" android:toYDelta="0%"
         android:duration="700"/>

</set>

Here is the code for moving from activity 1 to activity 2:

Intent intent=new Intent();
            intent.setClassName(Generator.this,"com.xyz.activity2");
            startActivity(intent);
            finish();
            overridePendingTransition(R.anim.left_to_right, R.anim.left_to_right);

Here is the code for moving from activity 2 to activity 1:

    Intent intent=new Intent();
                    intent.setClassName(MainMenu.this,"com.xyz.activity1");
                    startActivity(intent);
                        finish();
overridePendingTransition  (R.anim.right_to_left, R.anim.right_to_left);
  • 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-14T18:19:27+00:00Added an answer on June 14, 2026 at 6:19 pm

    use this….

    in A Activity.java

    Intent i = new Intent(A_Acitivity.this,B_Activity.class);
    startActivityForResult(i,100);
    

    and this is OnActivityResult Method…

    @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            // TODO Auto-generated method stub
            super.onActivityResult(requestCode, resultCode, data);
            overridePendingTransition  (R.anim.right_to_left, R.anim.right_to_left);
    
        }
    

    onCreate() of B Activity.java

       overridePendingTransition(R.anim.left_to_right, R.anim.left_to_right);
    

    on back button of B Activity

    just call finish();

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

Sidebar

Related Questions

I have two activities. In first I come to the second activity from first
i have two sub activities apart from main activity. The sequence of calls go
I have two activities A and B. B : is a setting activity that
suppose that you have two activities A(which is the main activity) and B when
I have two activities, Activity A and Activity B. I pass objects from Activity
I have two activities A, B . Now from A i call B by
I have two Activities. Activity A gets a large amount of information from the
I have two activities, A and B. Activity A implements a LocationListener that periodically
I have two activities that need to use my Facebook object. The first activity
This is my situation. I have two activities: ONE and TWO. In TWO activity

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.