When I go one activity to another activity , between the transaction a Black screen is come for some seconds. I properly finish the activity before calling startActvity().
Am using android:theme="@android:style/Theme.Translucent" theme for my activity. Even though between the activity transaction a black screen is coming
Can any one please tell me how to resolve this
Thanks in advance :)
There is no need to finish activity before calling startActivity().
Make sure that you have set content view in the onCreate of called Activity and that you are not blocking UI thread (check onCreate, onStart and onResume if you have override them).
for disable this default animation create one style:
<style name="noAnimTheme" parent="android:Theme">
<item name="android:windowAnimationStyle">@null</item>
</style>
and set it as theme for your activity in the manifest:
<activity android:name=".ui.ArticlesActivity" android:theme="@style/noAnimTheme">
</activity>
Assumption :-
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.xyz);
// comment code here
}
If you go from activity A to B then try to comment code in OnCreate , OnResume in Activity B Like this and check what happen still black screen is coming or not.If coming then try to change theme.
You don't need to manage finshing your activity, this will be managed automatically when the activity is no longer in view. Just use:
startActivity(new Intent(this, MyNextActivity.class));
And use this code in whatever method you are using to navigate the activity changes.
If you make sure your window is the background of your activities you can set the window background to a color other than black:
<item name="android:windowBackground">@drawable/window_background</item>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/window_background"/>
</shape>
windowBackground in Android 6 (Marshmallow)
The other option is to manage transitions, so there is no gap between the end of the first transition and the beginning of the second. However, you have not mentioned transitions.
How to remove the delay when opening an Activity with a DrawerLayout?