Can't turn transitions off
I'm trying to have no开发者_开发知识库 animation between some of my transitions. I have this bit bit of code:
TextView pulse = (TextView) findViewById(R.id.pulseText);
pulse.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent myIntent = new Intent(v.getContext(), Pulse.class);
startActivityForResult(myIntent, 0);
finish();
}
});
So to stop animation, I added this after starting the activity:
overridePendingTransition(0, 0);
But that caused an error saying, "The method overridePendingTransition(int, int) is undefined for the type new View.OnClickListener(){}". So then I tried adding
`myIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ACTION);`
before starting the activity, but that didn't work either. Any ideas?
Try writing:
ActivityClassName.this.overridePendingTransition(0, 0);
where ActivityClassName
is the name of your activity class
EDIT:
To start Board.class from Pulse.class, instead of writing:
Intent myIntent = new Intent(v.getContext(), Pulse.class);
It should be:
Intent myIntent = new Intent(v.getContext(), Board.class);
You must go to your class Pulse
Add to onCreate(Bundle) the line:
overridePendingTransition(0, 0);
and probably you want to add this line to the onCreate()
of all your activities
精彩评论