0

As the title says, my Mobile shows a Black screen between an android transition. Here's my java main activity code:

public class Main extends AppCompatActivity {
int h=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);



}

public void a ( View view){

    startActivity(new Intent(getApplicationContext(), MainWithButtons.class));
   overridePendingTransition(R.anim.left_in, R.anim.left_out);
}

}

Here the java second activity:

public class MainWithButtons extends AppCompatActivity{
  @Override
protected void onCreate( Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_with_buttons);

 }
}

left_in.xml:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/accelerate_interpolator">
    <translate
        android:duration="400"
        android:fromXDelta="0"
        android:toXDelta="100%p"/>
</set>

left_in.xml:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator">
<translate
    android:duration="400"
    android:fromXDelta="-100%p"
    android:toXDelta="0"/>
</set>

When i comment the overridePendingTransition method i can open the second activity, so the onClick is not the problem.

  • Asked and answered here :) good luck and keep it up! http://stackoverflow.com/questions/20690764/overridependingtransition-for-sliding-activities-in-and-out-smoothly – Vitali Pom Mar 11 '17 at 15:10

1 Answers1

0

Ummmm maybe try to wait before openning, like open later. As I saw from a quick read it's a refresh problem. You're jumping probably from less complex activity, to more complex one, that's why you need the CPU preprocessor power (Kamehamehaaaa) and assign open later. You will still have a small delay, but the calls will be asynced and and the black screen will dissapear, since the CPau will tell Android Java, I'm going to open YOU now, please prepare everything and it will prepare.

Vitali Pom
  • 602
  • 1
  • 8
  • 29