Android and android Official Website

Source: Internet
Author: User

Android and android Official Website

The APP installation icon is not displayed.


Address: http://blog.csdn.net/caroline_wendy


In AndroidManifest registration of the started activity, add the data that is implicitly started:

<! -- Start interface --> <activity android: name = "me. wcl. activities. welcomeActivity "android: configChanges =" keyboardHidden "android: label =" @ string/app_name "android: theme =" @ style/NoActionBarActivity "android: screenOrientation = "portrait"> <intent-filter> <action android: name = "android. intent. action. MAIN "/> <data android: host =" AuthActivity "android: scheme =" com. wcl. www "/> <category android: name =" android. intent. category. LAUNCHER "/> </intent-filter> </activity>


Reference: http://blog.csdn.net/ydt_lwj/article/details/9419239/


Several solutions for deleting an application icon:

1. Remove the intent-filter in the Activity entry from the AndroidManifest. xml file.
<category android:name=”android.intent.category.LAUNCHER” />
Or change LAUNCHER to DEFAULT.


2. Add the following code to the program.
Show image:
PackageManager p = getPackageManager();p.setComponentEnabledSetting(getComponentName(), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
Hide icon:
PackageManager p = getPackageManager();p.setComponentEnabledSetting(getComponentName(), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
PackageManager. COMPONENT_ENABLED_STATE_ENABLED // display the application icon
PackageManager. COMPONENT_ENABLED_STATE_DISABLED // hide the application icon
There is a problem with using these two values to display and hide the application icons. After hiding, the application icons cannot be displayed, and they cannot be found in all the applications in the settings;
It is no problem to set the parameter value to the two values. We recommend that you use these two values.

3. Remove the resources in android: icon = "@ drawable/ic_launcher" and so on...

However, after trying each method, you will find that it works, but there are other problems:

1. If <category android: name = "android. intent. category. LAUNCHER"/> is removed, the app has no startup entry,
This does solve the problem of not displaying icons, but then our applications cannot run.

2. Let's take a look at the instructions on android developer:
Public static final int COMPONENT_ENABLED_STATE_DISABLED
Flag for setApplicationEnabledSetting (String, int, int) and combine (ComponentName, int, int): This component or application has been explicitly disabled, regardless of what it has specified in its manifest.
This means that even if you declare this component or application in manifest, they are unavailable when you set it to COMPONENT_ENABLED_STATE_DISABLED. That is to say, if you set this in MainActivity, the application icon will not be displayed, and the application will not run.

3. I don't think so.

Optimal Solution:
This method can hide the icon and start running normally.
Set the <data> </data> element in intent-filter in the manifest entry activity.
For example:
<data android:host=”AuthActivity” android:scheme=”com.android.example” />
Note: android: scheme is case sensitive and must start with a lowercase letter.
That is, this MainActivity can respond to a specific Intent of com. android. example: // AuthActivity.
But why does the app not display the icon after this addition?
Because we declare the app entry Activity to start by receiving the hermit's Intent, it will naturally not display the icon.
If you need to display the icon and must respond to the above Uri, you can add an intent-filter tag in the Activity to move the data element to the new tag.
In this way, the application can display icons and respond to specific Uris.




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.