Splash Screen Doesn't Display First On The Application - android

Good day, I'm doing a project and, I'm new with android development also, I just want to ask how to display my[the] splash screen first on my app (when starting up my application). Whenever I run it on emulator or on my device it directly go to my main activity.
Splash Screen Image
Main NavDrawer
I even reorder my manifest file list - and place the splash screen first
here my code
<!-- For Splash Screen -->
<activity
android:name=".activities.SplashScreen"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- For Main Activity -->
<activity android:name=".activities.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Whenever I exit my app and start again, my splash screen is gone! It directly go to Main Activity.
Thanks in advance! :)

You are having 2 LAUCHERS...
Make sure that only the Splash Screen Activity is the LAUNCHER.
Let the Main Activity be a DEFAULT one (and also the HOME one).

Related

Android app showing 2 icon in device while testing

I'm new to android and Developing very basic App. I have completed my development but when ever I debug my app in device. It shows 2 icon. I'm facing this problem after implementing Splash Screen in my app. Please suggest me how to overcome. My manifest
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/icc"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".SplashScreen"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Login_page">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
In your manifest file -
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
This piece of code means which activity will first start when you launch the app. But you have put this code in both of your activities hence Android provides a separate launcher for both the activities and you see two icons.
So remove the above code from one of the activities. Just let it remain in the Activity you want to start first when your app launches.
TO have a icon on the launcher screen you need action of the activity to be action_main and category to be launcher and your both activity qualifies the criteria for this.
You should change your login_activity category to default or simply remove the category.
You can start your login activity from splash activity.
I hope it helps you.

What's Default Activity?

I am registering my app on Facebook Developer, which need to know what my Default Activity. Sorry if it's a stupid question but the Default Activity is my splashscreen (App boot with logo) or the first screen after loading the splash screen?
Default activity is the starting activity that is defined as "MAIN" inside android manifest file
<activity
.......
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The one defined by action.MAIN intent in your AndroiManifest. Splashscreen in your case.

Application icon does not open last used activity

In some situations (I do not know exactly what causes this to happen),
if I start my app, open another (here AaaActivity) activity and then click the home button to get to the phone home view, and then click the app icon from there, it starts in the application home view, instead of starting in the last open activity.
Why is this and what do I need to do to make it return to the last used activity (AaaActivity)?
Here is an excerpt from the manifest:
<activity
android:name="x.y.app.android.SsssActivity"
android:theme="#style/NoTitleBarNoBackground">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="x.y.app.android.AaaActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="#string/activity_videoview"
android:launchMode="singleTop"
android:screenOrientation="sensorLandscape"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="x.y.app.android.AaaName" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Multiple tasks can be held in Android OS in the background at once. However, if the OS is running many background tasks at the same time, the system might begin destroying background activities in order to recover memory, causing the activity states to be lost. This is OS design and you can't prevent it. What you can do is saving your state so that you can retrieve it next time. Tasks in Android

Adding app launch icon to the home screen

I would like to place the app launch icon on the home screen once the user installs my android app. This should be done even if the user does not open the app.
I have tried adding "category android:name="android.intent.category.HOME" in the manifest file for my main activity. But this does not work.
Any pointers on how solve this issue?
Thanks
Srao
I think this would be enough:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

android menu Home item issue [duplicate]

I'm running my android app on my droid x2 device. this app has a menu with some items, one of which is the Home (the screen that launches when the app starts).
the problem is that when I tap on the Home item it brings up this menu,
I don't know why it does that and how i can fix it.
It works fine on the simulator, I'm gussing this is something that needs to be set up on the device.
I need to know if some has seen this menu before and if so what it is and when it shows up?
I actually fix this issue by adding a new activity to my manifest file. so what I had for the launcher activity was
<activity
android:label="#string/app_name"
android:name=".Home" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and I also added the following activity which would act just as a normal activity and in my menu selection I used the action name of this new activity.
<activity
android:label="#string/app_name"
android:name=".Home" >
<intent-filter >
<action android:name="com.mywebsite.app.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

Categories

Resources