android menu Home item issue [duplicate] - android

I'm running my android app on my droid x2 device. this app has a menu with some items, one of which is the Home (the screen that launches when the app starts).
the problem is that when I tap on the Home item it brings up this menu,
I don't know why it does that and how i can fix it.
It works fine on the simulator, I'm gussing this is something that needs to be set up on the device.
I need to know if some has seen this menu before and if so what it is and when it shows up?

I actually fix this issue by adding a new activity to my manifest file. so what I had for the launcher activity was
<activity
android:label="#string/app_name"
android:name=".Home" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and I also added the following activity which would act just as a normal activity and in my menu selection I used the action name of this new activity.
<activity
android:label="#string/app_name"
android:name=".Home" >
<intent-filter >
<action android:name="com.mywebsite.app.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

Related

How to make the app as launcher and the only open app in Android?

Is there a way to make my app the only running app in a device, what I mean is the only visible and open app? Once the device booted, the app will launch automatically while any tap to settings at status bar, back, home and recent apps button are disabled. Probably a custom Android OS is required or rooting the device will be enough? We plan to have a set of devices where users can only operate with one app. Thanks
You need to be able to remove current launcher app to the system part of the device.
Then it's as simple as:
Adding android:launchMode="singleTask" to activity tag in AndroidManifest.xml
Adding <category android:name="android.intent.category.DEFAULT" /> and
<category android:name="android.intent.category.HOME" /> to your intent filter
The end result should look similar to this:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.app.MainActivity"
android:launchMode="singleTask"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</activity>
</application>

Android app showing 2 icon in device while testing

I'm new to android and Developing very basic App. I have completed my development but when ever I debug my app in device. It shows 2 icon. I'm facing this problem after implementing Splash Screen in my app. Please suggest me how to overcome. My manifest
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/icc"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".SplashScreen"
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=".Login_page">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
In your manifest file -
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
This piece of code means which activity will first start when you launch the app. But you have put this code in both of your activities hence Android provides a separate launcher for both the activities and you see two icons.
So remove the above code from one of the activities. Just let it remain in the Activity you want to start first when your app launches.
TO have a icon on the launcher screen you need action of the activity to be action_main and category to be launcher and your both activity qualifies the criteria for this.
You should change your login_activity category to default or simply remove the category.
You can start your login activity from splash activity.
I hope it helps you.

My android application always be in launcher list

hi i am new in android application Development
after successfully Developed android application when i install apk of that application it is always under launcher list, and always ask to select default launcher when i press Home key. How to prevent app. to be in list under launcher.
manifest file code are as follow.
//Manifest
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.dewebclient.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.example.dewebclient.IpConfigure" ></activity>
<activity android:name="com.example.dewebclient.WebViewClientDE" />
<!--android:theme="#android:style/Theme.NoTitleBar"-->
</application>
Remove below line from your AndroidManifest.xml file.
<category android:name="android.intent.category.HOME" />
Explanation :
The category HOME is used to declare your application as a Home launcher. By putting this in the AndroidManifest.xml, user will have the option to have your application open upon pressing the home button.
According to Developer Docs.
This is the home activity, that is the first activity that is displayed when the device boots.
<category android:name="android.intent.category.HOME" />
Remove above line from AndroidManifest.xml .
<category android:name="android.intent.category.HOME"/>
Remove this and check.
This indicates that when you press home button, your app will be listed as an option to launch the launcher home or your home activity (along with all the applications which have this category in their manifest for an activity). To be more simple, whenever you press the home button, all the applications installed in your phone which have CATEGORY.HOME category and Action_Main in intent-filter in their AndroidManifest.xml will be listed (unless you have chosen some application as default) in a chooser for the user to select which HOME they want to launch.
change your intent filter look like below.
and relaunch application.
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
referenc this link

App launcher to reload from beginning in Android

I have created app to act like an home launcher. So when user clicks on the home button I get Complete action using Launcher or my app's name say for example "myhomelauncher".
When I click on home button and click myhomelauncher my application loads everything from first perfectly fine. Now when I am in the second screen in my application say I am looking at activity 2 in my app and now I click on Home button and click myhomelauncher I endup getting the same activity 2 windows it is not reloading. (It should reload and show up activity 1 rather than 2)
I have seen lot of apps that can reload everytime I click their launcher. Why not mine?
Here is what I have done in my manifest.xml
<activity
android:name=".MyLauncher"
android:label="#string/app_name"
android:persistent="true"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
I am not sure where is the mistake?
Please have a look into the documentation - what can be of interest to your problem are the following settings:
android:clearTaskOnLaunch
android:launchMode
I would suspect setting android:launchMode to singleTask could solve your problem, altough be careful which side effects this will cause.
So:
<activity
android:name=".MyLauncher"
android:label="#string/app_name"
android:persistent="true"
android:screenOrientation="landscape"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
should do the trick.
Look up launchMode. But be careful, with great power, comes great responsibility.
This is the relevant section in a menifest that seems to work for me. Note that I have put singleInstance in the launch mode because I don't want more than one of my app, ever.
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".usbEffects"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden"
android:screenOrientation="portrait"
android:launchMode="singleInstance"
android:configChanges="keyboardHidden|orientation"
android:label="#string/app_name" >
<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>

android menu Home item

I'm running my android app on my droid x2 device. this app has a menu with some items, one of which is the Home (the screen that launches when the app starts).
the problem is that when I tap on the Home item it brings up this menu,
I don't know why it does that and how i can fix it.
I actually fix this issue by adding a new activity to my manifest file. so what I had for the launcher activity was
<activity
android:label="#string/app_name"
android:name=".Home" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and I also added the following activity which would act just as a normal activity and in my menu selection I used the action name of this new activity.
<activity
android:label="#string/app_name"
android:name=".Home" >
<intent-filter >
<action android:name="com.mywebsite.app.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

Categories

Resources