How to change launcher icon and it's label from the application

后端 未结 2 1835
醉酒成梦
醉酒成梦 2020-12-10 00:06

How can I change the launcher icon and its label from my application runtime in Android? (if it is possible)
I mean the properties defined in AndroidManifest.xml<

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-10 00:59

    This entire answer is from this post and it was taken from P-A and CommonsWare.


    You cannot change the manifest or the resource in the signed-and-sealed APK, except through a software upgrade. or Try this, it`s work fine for me but not sure for all devices:

    1. Modify your MainActivity section in AndroidManifest.xml, delete from it, line with MAIN category in intent-filter section.

      
        
         
         //DELETE THIS LINE
       
      
      
    2. Create for your app, for each of your icons. Like this

      
      
      
      
         
      
      
    3. Set programmatically ENABLE attribute for necessary

      getPackageManager().setComponentEnabledSetting(
      new ComponentName("ru.quickmessage.pa", "ru.quickmessage.pa.MainActivity-Red"), 
          PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
      

    Note, At least one must be enabled and above code perfect working up to 4.0 not tested into >4.0.

提交回复
热议问题