I changed the initial page in my app to be the "login" activity
but now I get the app name in my mobile called "login"
I checked #string/app_name it show "MyApp" yet the app name still "login" in my mobile
is there anyway to change the app name to "MyApp" without changing the login activity title?
here is my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.asmgx.myapp.app" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:name="com.asmgx.myapp.app.PubVar"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:debuggable="false">
<activity
android:name="com.asmgx.myapp.app.MainActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name="com.asmgx.myapp.app.add_msg"
android:label="#string/title_activity_add_msg" >
</activity>
<activity
android:name="com.asmgx.myapp.app.ItemDetail"
android:label="#string/title_activity_item_detail" >
</activity>
<activity
android:name="com.asmgx.myapp.app.ListFilter"
android:label="#string/title_activity_list_filter" >
</activity>
<activity
android:name="com.asmgx.myapp.app.login"
android:label="#string/title_activity_login" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.asmgx.myapp.app.test1"
android:label="#string/title_activity_test1" >
</activity>
</application>
</manifest>
If your Launcher Activity does not have a label in its intent-filter attribute, its label value will be inherited from the parent component (either Activity or Application).
So you just have to add a label on your intent-filter, like this:
<activity
android:name="com.asmgx.myapp.app.login"
android:label="#string/title_activity_login" >
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This will apply your App name the #string/app_name value and give the Activity title the #string/title_activity_login value.
See the accepted answer from this post for more info.
change #string/title_activity_login to "MyApp"
Related
I made an Android application, but when I look at it in my device, the appName just disappeared whereas I added it in the manifest and strings.xml. My application is the one at the bottom left
manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package.package.package"
android:versionCode="3"
android:versionName="2">
<application
android:allowBackup="true"
android:icon="#drawable/countdown_icono"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
// Activities
</application>
strings.xml
<resources>
<string name="app_name">I can\'t wait!</string>
</resources>
If someone could helps :)
SOLUTION :
<activity
android:name=".MainActivity"
android:label="APP NAME" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You probably need to add
android:label="#string/app_name"
inside your Activity tag in the AndroidManifest.xml.
<activity android:name=".theJavaClassActivity"
android:label="yourString">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Android Launcher shows the title of the activity that has the Intent-filter of android.intent.action.MAIN. In this way it is able to show more than one activity icons and titles if your application requires so.
When I run my application, it starts up the activity_main.xml file instead of the login.xml file. When I go into my AndroidManifest, what do I change to make it so that the login file runs on start up? Thanks in advance!
Here is the AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dashboardactivity"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.dashboardactivity.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>
</application>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:label="#string/app_name"
android:name=".DashboardActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Login Activity -->
<activity
android:label="Login Account"
android:name=".LoginActivity"></activity>
<!-- Register Activity -->
<activity
android:label="Register New Account"
android:name=".RegisterActivity"></activity>
</application>
<!-- Allow to connect with internet -->
<uses-permission android:name="android.permission.INTERNET" />
NOTE:After editing the manifest looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dashboardactivity"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.dashboardactivity.MainActivity"
android:label="#string/app_name" >
</activity>
</application>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:label="#string/app_name"
android:name=".DashboardActivity" >
</activity>
<!-- Login Activity -->
<activity
android:label="Login Account"
android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Register Activity -->
<activity
android:label="Register New Account"
android:name=".RegisterActivity"></activity>
</application>
<!-- Allow to connect with internet -->
<uses-permission android:name="android.permission.INTERNET" />
When I run the app now, I get this error in the Console:
[2013-08-30 13:31:32 - DashboardActivity] Starting activity com.example.dashboardactivity.LoginActivity on device HT18YMA05067
[2013-08-30 13:31:32 - DashboardActivity] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.dashboardactivity/.LoginActivity }
[2013-08-30 13:31:32 - DashboardActivity] ActivityManager: Error type 3
[2013-08-30 13:31:32 - DashboardActivity] ActivityManager: Error: Activity class {com.example.dashboardactivity/com.example.dashboardactivity.LoginActivity} does not exist.
I have created a LoginActivity.java class so I don't know what's wrong.
what do I change to make it so that the login file runs on start up?
You don't really change the xml file that is loaded, you change the Activity that is the Launcher. You do that in the <activity> tag of the Activity that you want to change. Like you have here
<activity
android:label="#string/app_name"
android:name=".DashboardActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
delete that Intent filter from that <activity> tag and add it to the LoginActivity
<activity
android:label="#string/app_name"
android:name=".DashboardActivity" >
</activity>
<!-- Login Activity -->
<activity
android:label="Login Account"
android:name=".LoginActivity"></activity>
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
When I run my application, it starts up the activity_main.xml file instead of the login.xml file.
The layout.xml that is displayed is determined by what you use in your Activity in setContentView(). You could change that but that's probably not what you want. Its probably not just that you want a different layout but you want the LoginActivity to start when your app is opened and not the MainActivity.
You move
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
To the activity you want to run first, in this case, login.
this code causes for start activity
but it does not belong to xml file that are chosen by Activity Classes what ever xml (the layout file ) you have set in activity will be open.
add this code to that activity you want to start with but it must appear only once in manifest for only one activity
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
In your case
<!-- Login Activity -->
<activity
android:label="Login Account"
android:name=".LoginActivity">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I have exported an app with 3 activities (main, splash and another activity called "about") to an apk file. It works fine when tested on the emulator. After uploading to the Play Store and then downloading to my own phone, it installs fine on my phone. Good so far. However, the apk doesn't appear packaged - it's showing the separate activities and not starting with the splash screen as it did in the emulator. What could be the problem? It exported with no errors. When I was exporting, I gave the apk a name that was different than the package name in the manifest. Would this cause the problem? Here is the manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.spinner"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<activity
android:name=".SplashActivity"
android:label="#string/title_activity_splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".AboutActivity"
android:label="#string/title_activity_about" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Thank you for looking.
This intent-filter
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
tells Android launcher app to show icon associated with Activity this filter is attached to on its Launcher screen. When corresponding icon is tapped by user, launcher app starts that activity and your code is executed. You usually want one entry point in your application so edit your Manifest file and ensure only one Activity element uses it. In your case, I guess leave it for SplashActivity and remove from others. It should look like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.spinner"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<activity
android:name=".SplashActivity"
android:label="#string/title_activity_splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
</activity>
<activity
android:name=".AboutActivity"
android:label="#string/title_activity_about" >
</activity>
</application>
</manifest>
I'd also get rid of android:label from <activity> elements (just leave for <application>)
Following this: http://developer.android.com/training/basics/firstapp/starting-activity.html I am confused when editing the Android Manifest.xml file. It says that the file should contain this:
<application ... >
<activity android:name="com.example.myapp.DisplayMessageActivity" />
...
</application>
My android manifest.xml looks like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nick.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="15" />
<application android:label="#string/app_name">
<activity android:name="com.nick.myfirstapp.DisplayMessageActivity" />
...
</application>
</manifest>
and when I run the app everything goes fine except it says : "No Launcher activity found!
The launch will only sync the application package on the device!" Is this something missing from the android manifest.xml file?
declare Your Activity in AndroidManifest.xml as for Showing In Launcher as:
<application android:label="#string/app_name">
<activity android:name="com.nick.myfirstapp.DisplayMessageActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
see for more info how we set an activity which so in Launcher :
http://developer.android.com/reference/android/content/Intent.html
http://developer.android.com/reference/android/app/Activity.html
You need to change you manifest to the following. Doing this will tell Android that you want this Activity to be displayed in the Launcher using your icon.
<application android:label="#string/app_name" android:icon="drawable icon resource here">
<activity android:name="com.nick.myfirstapp.DisplayMessageActivity" android:label="Your Label">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
In the docs the used ... to show that your normal code goes here. What you're doing is fine for non-launcher Activities.
You are missing the launcher intent and therefore the app finds no activity to launch at the start.
You need to lay out the activity like so:
<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>
package="com.example.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.myfirstapp.DisplayMessageActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
I have the same problem everyone reports but this began happening suddenly. My app was working as expected, automatically launching the MAIN activity.
But all of the sudden it stopped working and I started seeing the No Launcher activity found! message.
This is my Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xitrica.android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="8" />
<application android:icon="#drawable/icon" android:label="#string/app_name"
android:theme="#style/Theme.Transparent">
<uses-library android:name="com.google.android.maps" android:required="true" />
<activity android:name="ElBusetonActivity" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="andoid.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="RouteInfoActivity"></activity>
<activity android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:name="GetDirectionsActivity"></activity>
<activity android:theme="#android:style/Theme.Dialog"
android:name="PointProviderList"></activity>
</application>
</manifest>
Sorry if I'm not posting this snippet correctly. It's the first time I ever post a question.
Thanks in advance.
<activity android:name=".ElBusetonActivity" android:label="#string/app_name">
try this, prefix (".") on activity name
here (.) refer to package path
Remove
category android:name="android.intent.category.DEFAULT"
as it is not required.
Say if you have the Activity names TestActivity
If you want the TestActivity to be the first to launch when you hit "run", simply add two lines:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
To the position like below in your AndroidManifest.xml:
<activity
android:name="TestActivity"
android:label="#string/name"
android:screenOrientation="portrait" >
<intent-filter android:label="#string/app_name" >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
use the dot before the activities in your manifest to declare it. or you can write the package name dot your activity name.
like this.........
<activity android:name=".ElBusetonActivity" android:label="#string/app_name">
if you not using package name then it decide the default one.