0

Possible Duplicate:
Android Left to Right slide animation

Can i make the screen that loads come from the left instead of the right.

Button bLeft = (Button) findViewById(R.id.buttonLeft);
bRight.setOnClickListener(new View.OnClickListener() 
{
    public void onClick(View v) 
    {
        startActivity(new Intent("Intent));
        finish();
    }
});
Community
  • 1
  • 1
user1385487
  • 65
  • 1
  • 9
  • what do you mean like an animation? – tyczj May 17 '12 at 13:39
  • sort of its more like a presentation were one button goes left and the other one right but i have different classes am using but the right button and the left button make the screen load from the standard right i was hoping for a better user experience where the new activity loads from the direction they ask – user1385487 May 17 '12 at 13:40
  • What are you working for - you're setting `Button bLeft` But, setting listener for `bRight` is that right? And, is that right for syntax of `startActivity` – Praveenkumar May 17 '12 at 13:43
  • exactly the bRight and Bleft the activity works fine i was just hoping for a way to the new activity enter the screen from the left instead of the standard right – user1385487 May 17 '12 at 13:45
  • Try these answer - [Left to right animation](http://stackoverflow.com/a/5151774/940096) and [Left to right](http://stackoverflow.com/q/6638566/940096) – Praveenkumar May 17 '12 at 13:47
  • am a lil lost that sounds for swiping correct? mine is just push buttons – user1385487 May 17 '12 at 13:50

1 Answers1

1

Try this -

Android Simple Activity Animation

Android Simple Activity Animation Example 2

silwar
  • 6,470
  • 3
  • 46
  • 66
  • Button bRight = (Button) findViewById(R.id.buttonRight); bRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startActivity(new Intent("intent")); this.overridePendingTransition(R.anim.animation_enterr, R.anim.animation_leavel); finish(); } }); – user1385487 May 17 '12 at 14:04
  • it gives me an error on the overridependingtransition – user1385487 May 17 '12 at 14:05
  • it doesnt do it and i had to put this on the code private void overridePendingTransition(int animationEnterl, int animationLeaver) { // TODO Auto-generated method stub – user1385487 May 17 '12 at 14:16
  • am a lil new to the android programing whats stacktrace? – user1385487 May 17 '12 at 14:21
  • its really long can you check to see if this looks right to you?Button bLeft = (Button) findViewById(R.id.buttonLeft); bLeft.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startActivity(new Intent("intent")); finish(); this.overridePendingTransition(R.anim.animation_enterl, R.anim.animation_leaver); } private void overridePendingTransition(int animationEnterl, int animationLeaver) { } – user1385487 May 17 '12 at 14:26
  • there is no red in the log :( – user1385487 May 17 '12 at 14:30
  • yes am runing it in a galaxy s 2 and a panteck burt but the transition doesnt happen – user1385487 May 17 '12 at 14:32
  • please make sure that you have set Settings>Display>Animation to Display all animations in your handset – silwar May 17 '12 at 14:35
  • both of them have all animations i just checked :( – user1385487 May 17 '12 at 14:37
  • try [this](http://stackoverflow.com/questions/3087366/displaying-activity-with-custom-animation) – silwar May 17 '12 at 14:38
  • sounds like a different approach but what happen is i have many activities linked to one xml file thats y i wanted to go the java route – user1385487 May 17 '12 at 14:44
  • [this](http://www.warriorpoint.com/blog/2009/05/26/android-switching-screens-in-an-activity-with-animations-using-viewflipper/) example also have good explanation – silwar May 17 '12 at 14:49
  • thank you both ill look into it haha i have to take some advil i got a headache from thinking i wish the world knew how hard programing is haha that way a tiny bug wouldnt be that big deanl :) – user1385487 May 17 '12 at 14:56
  • I havent founded yet but as soon as i do ill accept it, StackOverFlow is a great site – user1385487 May 17 '12 at 15:06
  • ive been looking but nothing works, can someone maybe check my code on the top to see if am missing anything for the transition? – user1385487 May 17 '12 at 17:33
  • 1
    finally found somenthing that works guys here is the linkhttp://www.anddev.org/novice-tutorials-f8/splash-fade-activity-animations-overridependingtransition-t9464.html – user1385487 May 17 '12 at 17:57