Splash screen problem? - java

Hi I have created a splash screen but I am not sure how to get it to start. I have tried putting it in the top folder but I can't get it to start, I realise this is because it is the last item I created on my app.
How do I get it to the top of the build path.

Have you placed your Splashscreen in your manifest.
Should place your Splashscreen as the first activity and then the main activity.
For eg:
//First Activity as Splashscreen
activity android:name=".SplashScreen"
android:screenOrientation="portrait"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
//Splashscreen activity ends here
Your main activity followed by remaining activities.
<activity android:name=".Aptv"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="portrait">
<intent-filter>
action android:name="com.ayansys.aptv.Aptv" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

Related

Why is my app icon showing as blank from the app grid list with android studio?

I have tried a many different links on here to figure out why my app will not show on the list of app when I download it, but I have had no luck. I have tried many different things. Is there something I am missing with getting Intent Filters set up in android studio?
<application
android:name=".GdpApp"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="#style/AppThemeNoActionBarOrangeMain">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<activity
android:name=".SplashActivity"
android:screenOrientation="landscape"
android:theme="#style/AppThemeNoActionBarSplash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
'''
Not 100% sure but it does seem strange that you have 2
"android.intent.action.MAIN"

How to change Activity Priority in Android Studio

Iam trying to add Splash screen to my existing Android Project, which is not MainActivity.Java, but by default Android Studio is executing MainActivity.Java first, So I want to change the Activity Priority so that my SplashActivity.Java will execute first and later Activity's will follow after the Splash Screen.
Make splash activity your launcher activity instead of Main Activity in Android Manifest.
<activity
android:name=".ui.splash.SplashActivity"
android:screenOrientation="portrait"
android:theme="#style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
modify your AndroidManifest.xml like this
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.circlefil.reactivetrip">
<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">
<activity android:name=".MainActivity"/>
<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
You need to add IntentFilter in you splash screen activity and from splash screen activity you have to link your main activity using Intent.
Add following code to your splash screen activity.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
How ever keeping an entire activity is not the best way to create splash screen. See this for more info: Here
To Start activity first you need to make it Launcher Activity in AndroidManifest.xml file.
<activity
android:name=".StartingActivityName">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

What is the best way to switch Android Activities?

I have been developing a map app for Android. Initially I intended to make the main screen the map itself. After discussion with my boss, it has been decided that I make a normal (non-map) layout as my first screen and then have a button to access that map.
I have the first screen ready to be used. The name of this activity is LocateActivty.java. The name of the map activity is MainActivity.java. Since I initially developed the map activity first, it obviously continues to be opened as the first screen.
What changes should I make to the files (if any) and to any configuration files to make LocateActivity.java my main activity?
EDIT - Manifest code
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.aquamet.saramap.MainActivity"
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="com.aquamet.saramap.LocateActivity"
android:label="#string/title_activity_locate"
android:parentActivityName="com.aquamet.sara.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.aquamet.sara.MainActivity" />
</activity>
</application>
The lines of XML in the manifest:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Need to be moved from the Activity tags for MainActivity, and put inside the tags for LocateActivity. This will then mean that LocateActivity receives the Launcher intent when the user opens your application

Starting app from the recent menu doesn't start the main activity

I have 3 activities (MainActivity, TwitterActivity, WebBrowserActivity).
WebBrowserActivity uses for showing web info from twitter.
Manifest:
1.
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
2.
<activity
android:name=".TwitterActivity"
android:label="#string/app_name"
android:launchMode="singleInstance" >
<!-- Used for OAuth callback -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="callback"
android:scheme="x-bker-oauth-twitter" />
</intent-filter>
</activity>
3.
<activity android:name=".TwitterWebBrowser" />
Starting twitter:
Intent myIntent = new Intent(mContext, TwitterActivity.class);
mContext.startActivity(myIntent);
When twitt is posted I close TwitterActivity (using finish(); method) and MainActivity shows. Than I press Home Button and goes to Android, than press home button and press my app icon, and I goes to TwitterActivity, but I need to go to MainActivity. How do this?
It is only on android version 2.3.7 and below.
In your manifest entry for the TwitterActivity, change android:launchMode="singleInstance" to android:launchMode="singleTop".
I think you are setting launchMode because you want to be able to jump out to the Twitter app or web page to authorize the user from TwitterActivity, and then return back to the same instance of your TwitterActivity when done. In that case, TwitterActivity will be at the top of your task stack, so singleTop will tell the system to reuse it.
The problem with singleInstance is that it makes the activity the only activity in the task, which probably explains why the recents menu is launching the TwitterActivity. (more info in activity element docs).
If you really need to use singleInstance, you should consider assigning it to its own task and excluding it from recents, for example (use your own name for taskAffinity):
<activity
android:name=".TwitterActivity"
android:label="#string/app_name"
android:launchMode="singleInstance"
android:taskAffinity="com.example.twitter"
android:excludeFromRecents="true">

Android app not showing in "All Apps"

After some changes I made to my app that I made so it would show the activities in a different order, the app icon no longer appears in the "All Apps" screen on the android device. It does, however, show up on the "Recent" screen. I think it has something to do with a configuration error in my manifest file. I would like the ServerChoiceActivity to be the one represented by the icon, and it's what launches when launch it from the recent screen, but the fact that there is no icon on the "All apps" or "Downloaded" pages confuses me quite a bit.
The application section of my manifest file:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" android:debuggable="true">
<activity android:name=".ServerChoiceActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<data android:mimeType="image/*"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name=".ServerSettingsActivity" android:screenOrientation="portrait" android:label="#string/settings_title">
<intent-filter>
</intent-filter>
</activity>
<activity
android:name=".ImageShareActivity"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<data android:mimeType="image/*"/>
</intent-filter>
</activity>
<activity
android:screenOrientation="portrait"
android:name=".MultiImageUploadActivity"
android:taskAffinity="test.affinity"
android:label="#string/multiupload_title">
<intent-filter>
</intent-filter>
</activity>
<activity
android:screenOrientation="portrait"
android:taskAffinity="test.affinity"
android:noHistory="true"
android:label="Bucket"
android:name=".BucketActivity">
<intent-filter>
</intent-filter>
</activity>
</application>
Any suggestions? The app works as expected when I launch it, and it was working fine, including showing the icon before I modified the manifest file.
Possibly because you have this in your ServerChoiceActivity intent-filter:
<data android:mimeType="image/*"/>

Categories