2014-09-04 147 views
1

因此,我想在第一次運行後隱藏啓動程序中的圖標。圖標已從發射器中消失,但它仍然出現在主屏幕上。主屏幕上出現Android隱藏應用程序圖標

我已經看到類似的應用程序 - 他們可以從啓動器應用程序列表中刪除自己的圖標,他們的圖標也不會出現在主屏幕上。

我用下面的代碼來隱藏應用程序圖標。我犯了什麼錯誤?爲什麼應用圖標出現在主屏幕上?

PackageManager p = getPackageManager(); 
    ComponentName componentName = new ComponentName(this, 
      com.aaa.xxx.dex.abc.class); 

p.setComponentEnabledSetting(componentName, 
      PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 
      PackageManager.DONT_KILL_APP); 

注:圖標從主屏幕三星Galaxy S4迷你(4.4.2),但它走了出現在三星Galaxy S3(4.3.0)的主屏幕上。任何建議,幫助讚賞

預先感謝您..

+0

這件事做任何箱子LAUNCHER活動清單檔案中的 – 2014-09-04 07:04:37

+0

抱歉,但我無法理解你解釋我是什麼什麼意思。 Plealse be elaborate – 2014-09-04 07:06:27

+1

爲什麼你想從主屏幕上隱藏應用程序 – 2014-09-04 07:10:11

回答

0
public void HideApp() 
     { 
     Intent localIntent = new Intent(cx.getApplicationContext(), yourClassName.class); 
     cx.getApplicationContext().startService(localIntent); 
     cx.getPackageManager().setComponentEnabledSetting(newComponentName(cx,yourClssName.class), 2, 1); 
} 




public void Appear() 
     { 
     PackageManager pm = context.getApplicationContext().getPackageManager(); 
      pm.setComponentEnabledSetting(new ComponentName(context, yourClassName.class), 
        PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); 
} 
相關問題