Different Activity starts on installation and lauch app, why? - android

I can't explain why my app starts the MainActivity on installation, but StartActivity on app launch.
To my knowledge, this is managed by the manifest.xml. But there I have the category.LAUNCHER and action.MAIN applied to the StartActivity and I want this task always to start first.
<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"
android:label="#string/title_activity_main"
android:theme="#style/AppTheme.NoActionBar" />
<activity android:name=".StartActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ImageEditActivity"/>
</application>
Can someone tell me why the app is behaving like that? Any suggestion and review are welcome. Thank you in advance

Related

lunching icon no create

i facing some problem the lunching icon when i running finish the install the file but the lunching icon is not work. i think is i deleted the Main_Activity by default, but i already at the manifest assign the intent default but still cant create the lunching icon.
<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=".CategoryActivity"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android:intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You put a : within the <action> tag in the string.
Replace it by a . and it should work :
<action android:name="android.intent.action.MAIN" />

Set an Activity as the initial activity of an android app [duplicate]

This question already has answers here:
Change application's starting activity
(13 answers)
Closed 5 years ago.
In my new android sudio project I created two activities. The first is the MainActivity and the second is called SecondActivity. The second is more like a sort of menĂ¹. Logically, when the app starts, SecondActivity must appear as first.
In the manifest I declared both the activities but I don't know how to declare them correctly so that SecondActivity appears as the first activity in the application after I loaded it on my Android device.
This is my project's manifest :
<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">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SecondActivity"> </activity>
</application>
Did you tried this, my friend
<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>
<activity android:name=".SecondActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Two options...
1) Move the intent filter.
2) Switch the android:name property since ordering does not matter
Try this:
<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>
<activity android:name=".SecondActivity"> <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter></activity>
</application>
The intent-filter tag let you choose trough the action wich activity will be the main.
Simply move the intent filters to the second activity like so:
...
<activity android:name=".SecondActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
The parts between the intent-filter tags (<intent-filter> and </intent-filter>) tell Android that this activity should be used when the launcher icon of your app is pressed (i.e. the initial activity).

Android: Changing the default acitivity removes access to application

I'm having an issue changing the default activity in my Android manifest
Initially, the MainAcitivity was the default activity but I would like it to change to the LoginActivity. When I do this however, the app disappears from the app drawer. The only way I can access the app information (uninstall, remove data etc) is via the application manager.
I've changed the tags on the LoginActivity entry in the manifest as suggested here but the issue is still there.
Here is a snippet of my current manifest:
<application
android:name=".ui.MyFirebaseApp"
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/title_activity_login"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
<activity
android:name=".ui.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="COMPANY_app_notification_click_action" />
</intent-filter>
</activity>
<activity
android:name=".ui.LoginActivity"
android:label="#string/title_activity_login"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
How would I get the application back to the app drawer?

New activity seemed to reset default but XML unchanged

Can't figure this one out.
I added a second activity to a project in Android Studio. The second activity is now what launches on the emulator instead of the Main Activity.
Below is the XML in the manifest. Do I somehow need to declare the "get_started" activity as a child of the Main?
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".GetStarted"
android:label="#string/title_activity_get_started"
android:theme="#style/AppTheme.NoActionBar"></activity>
</application>
Try adding a DEFAULT intent filter to the MainActivity
<category android:name="android.intent.category.DEFAULT" />

Default Activity not found

when running my app it always goes to the edit configuration.
i found a solution in here but couldn't find the source tab in open module settings. Is there any other way to solve this? I'm using the latest version of android studio.
Thank you for the help.
this is my AndroidManifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.mobapp.yurin.hkt">
<application android:allowBackup="true"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan">
</activity>
</application>
You didn't set the default launcher for the application. Try this:
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Categories

Resources