views:

48

answers:

1

First off I am a beginner in Android development; I have been doing a lot of research into how to get the various tasks I am trying to complete. I have yet to find any similar issue to this, which is why I am asking it.

This is a multipart question.

Overview of program and problems: I have a program (for Android 2.1 and higher) that has multiple fullscreen Activities. I am required to have a different animation for transitioning to each one. So I reconfigured a couple files and made a ViewFlipper to do the transitions. Unfortunately some of these activities use a title. At the same time the transitions that I have tried applying based on the tutorials I have found online are not working as expected. The transition begins, the second screen is shown (faded) and the background is black, as the second screen nears completion of the transition the first screen reappears before disappearing again.

Question 1: Is there a way to display some layouts with a title and some without? If not then is there a way to change the transition used when startActivity is used?

Question 2: Is there some method of doing a fade transition without it flashing the original screen? I looked up the "flicker" issue but the solutions are not working for my project.

Question 3: In a similar manner to the 2nd question, the first layout shown is a loading screen, then the main screen. This happens just fine but for some reason the loading screen is shown, then slides off (as if startActivity is called) and then it fades into existence again (this time with a title which isn't supposed to be there), then switches to the main screen correctly. What might be happening here?

If you have any questions, feel free to ask.

A: 

Q1: yes it's possible, you can set the flag for each activity

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);

or in xml via style:

    <item name="android:windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>

Q2: yes, that should be the usual way. But to answer your question we need to see the code you're using. If you want to change the transitions of an activity (not view), you can put in it's onCreate method:

    super.overridePendingTransition(R.anim.bounce, R.anim.fadeout);

to define which animation to show when the activity enters the screen. You can use the same method in onFinish().

Q3: as Q2: need to see your code.

Mathias Lin
Thanks for responding: Q1: I use the Fullscreen flag already but that hides the status (which I want) but I need it to hide the title. I know I can change this when starting a new activity but it doesn't work after the activity is created. I tried changing styles and setting window features. Q2: I tried that just now and that basically eliminated Q1 because I am using Activites again (which can have the title visibility changed). It also removed Q3.
rcmaniac25
Ran out of comment space: It cause one more issue with Q2, it seems to work for going "to" another Activity but not coming "from" an activity, even when the exit/enter animations occur. I forgot to mention one of the animations is a 3D flip, I'm not sure that would be possible with this method but will see if I can pull it off. If you have any other ideas or questions feel free to ask. Thank you again though.
rcmaniac25
If you are using a 3D flip i.e. around the y-axis, then you should use an ActivityGroup with two embedded activities. I've done the same before. Not sure if it also works with two standalone activities, never tried. It would mean you would need to rotate the activity at creation time around 90 degrees, before you show it.
Mathias Lin
About your new question: yes, it would mean you should put the overridePendingTransition in onCreate and onFinish in every of your activities.
Mathias Lin
Thank you again, the transition occurs just fine (with a flicker but I remeber reading that I have to change visibility). I am currently trying out how to do the 3D transition.
rcmaniac25
For a 3D flip, take a look at http://www.inter-fuser.com/2009/08/android-animations-3d-flip.html
Mathias Lin