Why does my android application create too many items on Device - android

My self-developed android app create 7 items on Device with the same name, but in Settings -> Applications -> Manage Applications there is only one item. All classes of my app have the same package. Can anyone explain for me why?
Thanks you so much.

I understand that your problem is your getting 7 app with same names in the device when your installing it.
If this is so, then check the activtity tag in manifest file,it should contain only one action.MAIN ( mentioned below) , if you added this all activities the above scenario can happen. To resolve , remove this tag to all activities except main activity.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Hope it helps.

Related

Why it is showing two apk files when running the app on a device

I have created an app ,for showing the users current location in the startup and another activity for enter a destination,i have used Maps activity for displaying current location,and a intent is passed to another activity when a button is clicked.The problem is it is showing two apk files in the device one for maps activity and another for second activity and when i create a signed apk,the maps activity was not showing nothing ?How can i solve this issue??
I had this issue too. Have a look at the manifest and check if you have multiple rows in the whole manifest containing the
"android.intent.category.LAUNCHER"
In case yes: remove the ones that are not related to the main activity.
The correct template, that is ONLY for the main activity, is the following:
<activity android:name="MainActivity">
<!-- This activity is the main entry, should appear in app launcher -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

MyFirstApp installed on emulator but can't launch it

I'm going through the Android 'Building Your First App' tutorial and have gotten stuck trying to run the app. I created the app and emulator with Eclipse (Juno Build id: 20120920-0800 on OS X, default installation. The Android SDK, etc. was updated today).
The app appears to be installed on the emulator. I.e. 'Home -> Menu -> Manage Apps' lists it and it's App info looks ok. (Total=24.00KB, App=24.00KB, USN storage app=0.00B, ...).
However, it does not appear in the apps launch list (i.e. the screen with 'API Demos', 'Browser', etc.
Is there some other way to launch it? Is there something I have to do to get it into the app list? Any help would be appreciated - this is driving me crazy.
thanks
In your manifest xml file you need to make sure that you have
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
in your activity definition. If you don't see your application in the launcher then it suggests you don't have "android.intent.category.LAUNCHER" set.
Your manifest file should have something like (this isn't a complete manifest)
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".MyActivity"
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 can't just put the intent-filter lines in your manifest. If you double click the manifest it will open up. You get 2 methods to edit it, raw XML or using a basic interface. Personally I think you're better off with the raw interface. Look below the window that opens when you double click the manifest, you'll see some tabs like Manifest, Application... the last on is AndroidManifest.xml - this is the raw xml. The first one is basic setup.
Don't forget to save your manifest file and do a clean and build then run it.

No launcher icon

I have an interesting problem - at least for me.
I don't want my application to have a launcher icon in the menu - I start it remotely and I don't want to show it up in the menu.
How can I solve that?
My idea is deleting the following from the manifest:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Would this solve my problem?
Delete that:
<category android:name="android.intent.category.LAUNCHER" />
And you won't have a launcher icon.
That's what i would do. This defines the gateway activity to your application and doesn't affect the functionality. If no activity has this filter, there won't be an icon to launch it manually, precisely what you want.
https://stackoverflow.com/a/13552763/6481542 is correct, but to address the Android Studio compilation issue noted in the comments, you need to modify the Run Configuration in Android Studio:
Go to Run -> Edit Configurations
Under Launch Options, change Launch from Default Activity to any of the other options. Using Specified Activity with one of your activities is a suitable approach.
This works with Android Studio 2.2.3.

How to add a second launcher icon to an app previously published in the Market with only one launcher icon?

I want two launcher icons for two different activities in my application. I have added this to the Manifest file.
<activity ... android:name=".TestActivity01">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity ... android:name=".TestActivity02">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This works fine if you install the app with the two launcher icons since the beginning.
My problem is that I have already published my app in the Market with one icon launcher only. If I just add the intent-filter with the .Main and .Launcher options to another activity it doesn't work when the users update the app. They keep having one icon only. If they uninstall the previous version and then install the new one then they will have the two icons.
Question: is there a way I can force a "clean" upgrade? I don't have problems with loosing information.
Hi first time u have update the application in android market one lancher and second time u have update the next version your application in this application u have check the package u can modify the mainfest file another lanching activity what is the use two lanching icons (user download u r app this time another app download option is it correct ) In android market every updations only compare to package only.

When I install my apk I get an icon for every class in the project

I have a project in Eclipse with maybe 7 different classes that i open with Intent. The problem is when I install the .apk on my HTC phone I get an icon for every class. How do I make the project so it installs as one app only? /Johan Andersson
Exactly, as mreichelt said you have to remove this lines from each class declared on your Manifest except from the one you want to be the main Activity :D
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
If you only want one activity to be started from the launcher, just remove the intent filters for all other activities than your wanted one in your manifest. Read more here: http://developer.android.com/guide/topics/fundamentals.html#ifilters

Categories

Resources