0

I have a serious problem about the transition in a transparent activity. When the application is installed and launched for the first time in the emulator, the transparent activity does the transition very well. But when I'm going out from the application and go back to it, both of activities do the same transition!

WallpaperAct is the activity background & ConnexionForm is the transparent Activity

public class WallpaperAct extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_arriere_plan);
    Intent  i = new Intent(WallpaperAct.this,ConnexionFormulaire.class);
    startActivity(i);
    overridePendingTransition(R.animator.animationbas_haut,0);


}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.arriere_plan, menu);
    return true;
}   

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}

}

Thanks for helping me!

yole
  • 92,896
  • 20
  • 260
  • 197

1 Answers1

0

onCreate is called each time an activity is created, this is referring to the activity's lifecycle, not whether the application has just been installed, or not. Note the documentation for Activity:

Called when the activity is starting. This is where most initialization should go: calling setContentView(int) to inflate the activity's UI, using findViewById(int) to programmatically interact with widgets in the UI...

If you wish to determine whether the application is running for it's first time, then you may achieve that by setting (boolean) preference, say firstRun via SharedPreferences. For a specific example, you can check the SO question Check if application is on its first run.

Community
  • 1
  • 1
Patrick McLaren
  • 978
  • 10
  • 22