Я пытаюсь добавить экран spla sh в приложение, но оно у меня не работает. Я получил эти коды из других проектов, и он прекрасно работает в нем, но я не знаю, почему здесь не работает ссылка для проекта, который я получил коды https://github.com/SabithPkcMnr/SplashScreen
Вот мой код
SplashActivity
public class SplashActivity extends AppCompatActivity {
int SPLASH_TIME = 3000; //This is 3 seconds
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splach);
//Code to start timer and take action after the timer ends
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
//Do any action here. Now we are moving to next page
Intent mySuperIntent = new Intent(SplashActivity.this, MainActivity.class);
startActivity(mySuperIntent);
//This 'finish()' is for exiting the app when back button pressed from Home page which is ActivityHome
finish();
}
}, SPLASH_TIME);
}
}
MainActivity
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Make the app support only arabic "Right to left"
//Even if the languish of the device on english or others
ViewCompat.setLayoutDirection(getWindow().getDecorView(),ViewCompat.LAYOUT_DIRECTION_RTL);
}
Манифест
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:roundIcon="@drawable/icon"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".SplashActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>