Hide Android app icon programmatically takes longer than expected (~ ~ 9 seconds)

Hiding the Android app icon from the Android app list programmatically works correctly, but hiding (almost 9-10 seconds) takes a long time.

I used below code to hide and show the app:

PackageManager p = getPackageManager();
    ComponentName componentName = new ComponentName(this, com.apps.MainActivity.class); // activity which is first time open in manifiest file which is declare as <category android:name="android.intent.category.LAUNCHER" />
p.setComponentEnabledSetting(componentName,PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);

      

Here's how to get the app icon back.

PackageManager p = getPackageManager();
ComponentName componentName = new ComponentName(this, com.apps.MainActivity.class);
p.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE

      

Is there a faster way to do this? Or is it okay?

+3
android android-package-managers


source to share


No one has answered this question yet

Check out similar questions:

436
Building and running an application through Gradle and Android Studio is slower than through Eclipse
410
Change app language programmatically in Android
298
How to programmatically open the permission screen for a specific app on Android Marshmallow?
228
Hide / Show Android Soft Keyboard Programmatically
162
How do I programmatically "restart" an Android app?
57
Android hide / hide app icon programmatically
1
How to hide / remove / avoid a system app (not UI) to show / show in android app drawer?
0
Hide app from recents programmatically
-1
Android Studio How to run an app but it shouldn't run
-1
Hide all home screen apps on Android



All Articles
Loading...
X
Show
Funny
Dev
Pics