<activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:windowBackground">@drawable/splash_background</item> </style> <activity android:name=".MainActivity" android:launchMode="singleTask"> SharedPreferences sharedPreferences = getSharedPreferences("AppPreferences", MODE_PRIVATE); boolean isFirstLaunch = sharedPreferences.getBoolean("isFirstLaunch", true); if (isFirstLaunch) { sharedPreferences.edit().putBoolean("isFirstLaunch", false).apply(); } else { } public class WelcomeActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_welcome); new Handler().postDelayed(new Runnable() { @Override public void run() { Intent intent = new Intent(WelcomeActivity.this, MainActivity.class); startActivity(intent); finish(); } } }


上一篇:
下一篇:
切换中文