my Splash activity doesn't change, it only changes if I change the name to another.
For example: "SplashActivity" - Start with a Modification
If I change the theme to another color, I need to rename the activity to: "SplashActivityy" or some other name than it was.
If I go back to the name "SplashActivity" the modification goes back to later.
Already formatted and cleared cache of android studio, this did not help!
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.cobaiascreen">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name=".App"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAINACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
SplashActivity.java
package com.example.cobaiascreen;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Hiding Title bar of this activity screen */
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
//Making this activity, full screen */
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
}
App.java
package com.example.cobaiascreen;
import android.app.Application;
import android.os.SystemClock;
import java.util.concurrent.TimeUnit;
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
// Don't do this! This is just so cold launches take some time
SystemClock.sleep(TimeUnit.SECONDS.toMillis(3));
}
}
Styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/background_splash</item>
</style>
</resources>
background_splash.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/colorPrimaryDark"/>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/icon"/>
</item>
</layer-list>
EDIT: problems just like mine: Splash Theme is not changing anymore
EDIT 2: I asked a question in a thread to find out what was going on in my code, after a while fidgeting I didn't find walks on the internet related.
Already tried to clear cache, recreate the application, cleared the cache of files, already did everything in android studio.
After a while I found something talking to restart the application that would appear to change.
But I do not want the user to install my application to have to restart the application to appear the changes in the theme. How can I solve this problem?
from Activity does not change
No comments:
Post a Comment