Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: I Want Disappear my app icon from launcher


I want to disappear my App Icon from launcher and app will automatically restart after some time I did code for hiding icon below:

try {
PackageManager p = context.getPackageManager();
ComponentName componentName = new ComponentName("", "");
p.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
} catch (Exception e) {
Log.d("[email protected]@", "" + e.toString());

this is code for reopening my app after some time

public void initializingTimerTask() {
timerTask = new TimerTask() {
public void run() { Runnable() {
public void run() {
if (mIsInForegroundMode == false) {
Intent LaunchIntent=getPackageManager().getLaunchIntentForPackage("");
} else {

The error:

11-16 14:10:02.802 18503-18503/com.package.newproject E/AndroidRuntime: FATAL EXCEPTION:
main Process: com.package.newproject, PID: 18503 java.lang.NullPointerException
at com.mspatel.package.newproject.AutoOpenAppService$1$
at android.os.Handler.handleCallback(
at android.os.Handler.dispatchMessage(
at android.os.Looper.loop(
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(
at dalvik.system.NativeStart.main(Native Method)

but when turn to restart application app going to crash please help me.

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered

This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: I Want Disappear my app icon from launcher


Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription