I want my activity view to disappear when I click on the button. I put the animation code inside the OnClickListener () button, but fading does not happen. So, any idea, how can I fade out the current activity when a button is clicked? Thanks in advance.
Actually, my goal: in my application, when an action begins, the kind of activity will disappear, and as the action ends, it will disappear, and then the new representation of the activity will disappear. Below im giving my code, please help figure out the problem there .....
public class First extends Activity { Animation slide; View view; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); view = (View) findViewById(android.R.id.content); slide = AnimationUtils.loadAnimation(this, R.anim.fade_in); view.startAnimation(slide); Button btn = (Button) findViewById(R.id.retour); btn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(v.getContext(),Second.class); slide = AnimationUtils.loadAnimation(First.this, R.anim.fade_out); view.startAnimation(slide); Test.group.replaceContentView("Second", intent, 0); } }); } }
source share