Application crashes when I bind MainActivity to Launcher Intent - java

Below is the list of classes I have in my application. I am trying to to make MainActivity to be the first to show but my app always starts from the Dashboard. When I change it my app crashes.
<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=".Dashboard"
android:screenOrientation="portrait"></activity>
<activity android:name=".Music"
android:screenOrientation="portrait"/>
<activity android:name=".MusicVideo"
android:screenOrientation="portrait"/>
<activity android:name=".Home"
android:screenOrientation="portrait"/>
<activity android:name=".News"
android:screenOrientation="portrait"/>
<activity android:name=".Relationship"
android:screenOrientation="portrait"/>
<activity android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>`
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

Related

Get "Default Activity not found" when I want to change the starting activity

https://github.com/rrsaikat/Scientific-Calculator-Calc-
I am creating a ScientificCalculator by referring to the above Github link, and I want to display the login activity before opening the calculation screen, but the Default Activity not found is displayed. What should I do?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rrsaikat.calc">
<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=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.LOGIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity">
</activity>
<activity android:name=".LauncherActivity">
</activity>
</application>
</manifest>
Before I edit↓
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rrsaikat.calc">
<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.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Why my Application name is the same as Activity name?

Why is my app name "Money" instead of "My Application" ? What can I do to change it to "My Application"?
https://i.stack.imgur.com/9buup.png
#string/app_name = My Application
#string/main_activity_title = Money
<application
android:name=".MyApplication"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppBaseTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".activities.money.list.MoneyActivity"
android:exported="true"
android:label="#string/main_activity_title"
android:launchMode="singleTop"/>
<activity-alias
android:name=".MainActivity"
android:label="#string/main_activity_title"
android:launchMode="singleTop"
android:targetActivity=".activities.money.list.MoneyActivity">
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity-alias>
</application>
in your values/strings.xml change
<string name="app_name">Money</string>
to
<string name="app_name">My Application</string>
Try this.....
<application
android:name=".MyApplication"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppBaseTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".activities.money.list.MoneyActivity"
android:exported="true"
android:launchMode="singleTop"/>
<activity-alias
android:name=".MainActivity"
android:label="#string/main_activity_title"
android:launchMode="singleTop"
android:targetActivity=".activities.money.list.MoneyActivity">
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity-alias>
</application>

App name not being displayed

My Android app is not displaying the application name "app_name",I have multiple activities but when I restart the app, the first page of the app doesn't show the app name but in other activities it shows the app name. i don't know what is wrong anyone can help me.
This is my AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".HomescreenActivity"
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="QuizDetailsActivity"
android:label="#string/app_name" >
</activity>
<activity android:name="QuestionListActivity"
android:label="#string/app_name">
</activity>
<activity android:name="QuizActivity"
android:label="#string/app_name">
</activity>
<activity android:name=".ResultsActivity"
android:label="#string/app_name">
</activity>
</application>

Strange behaviour of an alphaApk's shortcut

I have noticed that my application that is published to an Alpha test has a strange behaviour... The shortcut is launching the MainActivity again. Everything is working fine when it's installed via generated .apk
My Android-Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.YYY.XXX">
<application
android:name=".Infrastructure.XXXApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".activities.MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activities.BaseActivity" />
<activity
android:name=".activities.SettingsActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".activities.SavedResultsActivity"
android:screenOrientation="portrait"/>
</application>
</manifest>

Default Activity not found Waiting for process

When I am trying to debug-run my application I am getting this error in console:
Default Activity not foundWaiting for process: com.myapp.myapp
My AndroidManifest look like this:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name="com.myapp.myapp.Splash"
android:label="#string/app_name"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.Main" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.myapp.myapp.Main"
android:label="#string/app_name"
android:launchMode="singleInstance"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.Main" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
This doesn't work for me because I can't find any sources tab as mentioned there.
For the second activity, in intent filter, change android:name to com.myapp.myapp.Main .

Categories

Resources