Two icons created when using two activities - android

Two icon created when i using Two activity Android Studio.
I don't know why is this.
I delete intent and I do some works but it's didn't worked.
I am creating one app.
And I run in physical device.
And that app has two icons.

I find my problem and I will clear .
`
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>`
here you will two category . you will delete number two category .
This is our problem . android.intent.category.LAUNCHER this create a app icon for second activity.

Just remove these lines from one of your two activities (if you have a SplashScreen and a MainActivity, remove them from your MainActivity)
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Answer from https://stackoverflow.com/a/29735556/8577483

Related

How to hide an app in the Application Manager

I want to make my Android application invisible and work through a background task.
This part should work like these two apps, if anyone knows them:
https://www.keeperschildsafety.net/
https://www2.mspy.com/
I already found examples for making the app icon invisible, but I want to go one step further.
This is the site I found that on:
https://readyandroid.wordpress.com/hideunhide-app-icon-programmatically-android/
I also found some explanations that I should delete the <intent-filter>:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
But then I am not able to start my application.
On all other sites I read that this is not possible, but the two examples shown at the top prove that it is actually possible somehow.
I want to start my application once, then hide it and unhide it later.
I already know how to trigger the unhide. The only part that I need is the hiding and unhiding itself.
You need to remove the following line from your AndroidManifest.xml:
<category android:name="android.intent.category.LAUNCHER"/>
This will remove the application from the default launcher. However, you also need to add the following line such that your BroadcastReceiver is not completely ignored:
<category android:name="android.intent.category.DEFAULT"/>
You should NOT remove the line below - it is used to specify which Activity should launch first when your app is opened:
<action android:name="android.intent.action.MAIN"/>
also try this
<activity android:name=".MainActivity"
android:excludeFromRecents="true" ...
in your AndroidManifest.xml's activity declaration.

when I install the application on the real gadget, 2 icons are created. Why?

My android project tree looks like that... (I owner too "low reputation to post image", so...)
----------------------------
...
src
AppStart.java
DBHelper.java
SecureMessagesActivity.java
Settings.java
SmsReceiver.java
...
----------------------------
When I install app to real device, I can see two icons names
1. SMS Cipher (project name)
2. Setting (click on this icon open settings.java)
It's unacceptably...
How can I avoid it? I just want that 1 icon was created.
Thanks.
It seems You have added <action android:name="android.intent.action.MAIN" /> in two activities so this problem occurs.I would recommend you to add intent filter action main in only launcher activity which will the 1st activity of your App.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Don't use Action MAIN in more than one activity

single app with different launches to configure and run in android

I have a requirement to do an app to function like this.
Its an android application and it should have 2 launching methods.
One is to proceed the function directly when touching the icon.
Another icon should be there to give the setting to the same app to set the setting the settings of the android application.
Basically the app should work like the screen off and lock app in the market.
How can i achieve these 2 things in one app? When i install the app, i need to have two icons, one to do the functionality directly and other to set the settings of the application.
I believe you are trying to have to separate launchers (icons to start apps) in your app, launching two different activities. This is easily achieved within your manifest. Create two activities, say MainActivity and SettingsActivity and then declare them in manifest as launch-able - with different titles:
<activity
android:name=".MainActivity"
android:label="#string/main_activity_title"
android:icon="#drawable/main_icon">
<intent-filter android:label="#string/main_app_title">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SettingsActivity"
android:label="#string/settings_activity_title"
android:icon="#drawable/settings_icon">
<intent-filter android:label="#string/settings_app_title">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
When your app is installed, there will be two icons created: one to start the MainAcivity and another one to start SettingsActivity.

Multiple Activities = multiple Apps installed?

I'm just getting started with the Android SDK and after I just understood how to open another view with a MenuItem. I'm now facing a problem that it is showing me my two activities as separated applications installed?
I've created a new activity and a new xml file (layout) and when I touch the menuItem in the ActionBar in my first view it opens the second view.
Any idea to work around that?
It sounds like you have the <intent-filter> set as
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
for both activities. This will create a launcher icon for each and make each an entry point for your app
Docs
Most likely, you've included the following intent filter in both your Activities:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
This is meant to be put in only those Activities which you want shown in the app list.

adding custom action won't start the activity when running it in the emulator

I have the following code in my Manifest:
<activity android:name="com.fletech.android.apparent.CategoriesGrid"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
When I run the app in Eclipse it starts this activity in the emulator, as expected.
But when I also add:
<action android:name="com.fletech.android.apparent.action.APPARENT_MAIN" />
right below the other action, and run the app, it only installs it to the emulator but doesn't run it. Why?
What I wanted to achieve is this: I would like to be able to show a dialog to the user (from another apps) to chose between all my apps that have "com.fletech.android.apparent.action.APPARENT_MAIN" as an action.
If you want to specify another launch scenario, you should just add another whole intent-filter block rather than putting all of the action clauses in the same one.

Categories

Resources