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>
Related
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>
Ok here is the thing I created a project put it on github, then work more on it update it and push updates on github (this is the last version, 2 versions total)...however now whenever I run the app through android studio,(even the version downloaded from github, master) it installs two APPs on my phone...one is the older version and the other is the new version.. How can I remove the old version ? however I only see one android manifest, it seems that both versions are kinda connected together whenever I uninstall, the phone uninstalls them both
EDIT Before fixing
<?xml version="1.0" encoding="utf-8"?>
<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=".TeacherLogin">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".AddUpdateStudent" />
<activity android:name=".ViewAllStudents" />
<activity android:name=".MainActivity" />
<activity android:name=".NoteMainActivity" />
<activity android:name=".AddNotesActivity" />
<activity android:name=".MainMenuActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
After Fixing
<?xml version="1.0" encoding="utf-8"?>
<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=".TeacherLogin">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".AddUpdateStudent" />
<activity android:name=".ViewAllStudents" />
<activity android:name=".MainActivity" />
<activity android:name=".NoteMainActivity" />
<activity android:name=".AddNotesActivity" />
<activity android:name=".MainMenuActivity">
</activity>
</application>
Ok so appearntly the second intent was after the main menu which was the version 1.0 before the update, after the update I added login activity, hence why it looked like "2 apps with different versions" so there was no problem what so ever with git or github as I weirdly thought... I appologize if this question was kinda stupid now after I looked at it but I am really new to this android app development.
If you have two launcher icons, but only one entry in Settings > Apps, that means your one app has a manifest with two <activity> elements that each have the <intent-filter> to cause them to appear in the launcher:
<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=".SomeOtherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
That may just be a copy/paste error, or perhaps an accidental checkbox click in the new-activity wizard.
Regardless, unless you really do want two launcher icons, remove the <intent-filter> from the activity that does not belong in the launcher.
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>
I created a new class in my project called UserTypeSelection.java and wanted to set it as the main activity which launches when I run the app. I've changed the manifest file to contain an intent filter and also tried editing the configurations to set it as the default activity, however I keep receiving the error:
Error running app: The activity must be exported or contain an intent-filter
My manifest file is as follows:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.XXXXX.computerscienceinduction">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".UserTypeSelection" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<activity android:name=".RegistrationActivity"></activity>
<activity android:name=".MainActivity" />
<activity android:name=".LoginActivity" />
<activity android:name=".ProfileActivity" />
</application>
</manifest>
How can I resolve this issue. Any help is appreciated, thank you.
You are closing your activity xml tag before you have specified the IntentFilter.
Change your declaration to this.
<activity android:name=".UserTypeSelection" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
UserTypeSelection must be activity and it must be using intent filters you have not closed activity after intent filter it is closed before.
Try this,
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.XXXXX.computerscienceinduction">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".UserTypeSelection">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".RegistrationActivity"/>
<activity android:name=".MainActivity" />
<activity android:name=".LoginActivity" />
<activity android:name=".ProfileActivity" />
</application>
</manifest>
when I try to run the project it installs successfully on an emulator, but emulator does not show my app launcher icon in its app menu. but however it shows my app in installed apps in setting>applications>manage applications>all apps , so that means that an app was installed. but it didn't run.
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thenewboston.travis"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.thenewboston.travis.SPLASH" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Main"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.thenewboston.travis.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Menu"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.thenewboston.travis.MENU" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
Make sure your starting activity has its intent-filter declared properly in your manifest to be shown in the launcher.
Assuming you want "Splash" to be your main activity change its declaration to this (specifically the intent-filter action)
<activity
android:name=".Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Your intent filter action was not part of the android defaults (and what launchers normally look for). Only launchers that were designed to look for the action "com.thenewboston.travis.SPLASH" would see your activity
<activity
android:name=".Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.thenewboston.travis.SPLASH" /> //try "android.intent.action.MAIN" here//
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>