A little error in Android launcher - android

I install my launcher on my device. If I press home button and select my launcher always without opening my application, everything's OK. However, when firstly I start my application, then press home and select my launcher, it opens my application again and again. What should I do?
My manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.comeks.cocuktab"
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.comeks.cocuktab.Main"
android:label="#string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

No sure if it is your problem but try to but this in your aplication:
in Manifest:
<activity
android:noHistory="true"
android:excludeFromRecents="true">

Try adding this line in the manifest
<activity
android:launchMode="singleInstance"

Related

Application icon not appearing on the screen after compilation

Hi I am not able to find my application icon on the screen after installation of the app in the phone or in the virtual device .
The following are the changes done in AndroidManifest.xml I have added the icon
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstandroidapllication"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="5"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="hello.world.MyHelloWorld"
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>
</manifest>
and I have checked all the res folders for icons default icons are present. application is running succesfully when started from eclipse in emulator after adding action in manifest file . but no icon in the emulator also
The following are the changes in R.java
public static final class drawable {
public static final int icon=0x7f020000;
}
but also I am not able to view the icon after installation even in the mobile ie installation is success but icon is not visible on the screen
you have not defined an activity in your manifest as launcher :-
<?xml version="1.0" encoding="utf-8"?>
<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.globaldialog.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>
You are not declared your start activity into the manifest:
<activity android:name=".YourStartActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
After adding this into application tag, you will see app icon on launcher and tap on it will start YourStartActivity
<intent-filter>
//
<category android:name="android.intent.category.LAUNCHER" />
//
</intent-filter>
your launcher activity could be missing this intent filter, If yes, you need to add it.

Why is my Android app name same as the launcher activity name?

I understand that android:label= decides the name of the app.
I have done it properly as follows:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.drsystem"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" >
</uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
</uses-permission>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.drsystem.LoginActivity"
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.example.drsystem.CalibrationActivity"
android:label="#string/title_activity_calibration" >
</activity>
<activity
android:name="com.example.drsystem.DeadReckoningActivity"
android:label="#string/title_activity_dead_reckoning" >
</activity>
</application>
</manifest>
But my app name appears beneath the icon on the screen is still "#string/title_activity_login"
I want it to be "#string/app_name"
Anyone can help?
Thanks in advance
It's not really weird, but just good to know :
the Android's launcher use the Intent Launcher Label or if not set, the activity's label and finally application's label
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Naming my application in android
This is a bit weird in android...
App name is pretty much determined by first activity label.. or application label if it isn't set.
Just remove this line
android:label="#string/title_activity_login" from the Manifest file

Eclipse - .apk throwing out <activities>

Have a simple app with 2 activities. Works on USB / SYNC, but when I export it to get an .apk file, Mainfest.xml throws out any reference to the 2nd .
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.easy"
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=".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>
<activity
android:name=".StartingPoint" android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.easy.STARTINGPOINT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
The 1st activity (.Splash) gets deleted during compile. I've had this problem with my first project so I started over with a very simple one to see if its a continuing problem or my first project.
Seems to be a continuing problem.

Android if my launcher has not started and pressing home button

I've developed a launcher. In my device, there are 3 launcher with my application and the default launcher of Android. If I have not launched my application before, when I press home, my application appears on the launcher list. So, when I touch my launcher, it occurs error because of I didn't start it before. What can I do to solve this problem?
My manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.comeks.deneme"
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.comeks.deneme.Main"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:excludeFromRecents="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="#string/app_name"
android:name=".main.java"
android:excludeFromRecents="true" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
What is the name of the file of your second activity?
main.java.java?
Do you even have two different activities?

Android manifest.xml problems

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>

Categories

Resources