Example usage for android.content Intent ACTION_MAIN

List of usage examples for android.content Intent ACTION_MAIN

Introduction

In this page you can find the example usage for android.content Intent ACTION_MAIN.

Prototype

String ACTION_MAIN

To view the source code for android.content Intent ACTION_MAIN.

Click Source Link

Document

Activity Action: Start as a main entry point, does not expect to receive data.

Usage

From source file:com.wanikani.androidnotifier.MainActivity.java

/**
 * Restarts the activity //w ww .  j  ava2  s  . c o  m
 */
private void reboot() {
    Intent i;

    i = new Intent(this, getClass());
    i.setAction(Intent.ACTION_MAIN);

    startActivity(i);
    finish();
}

From source file:com.farmerbb.taskbar.service.TaskbarService.java

@SuppressWarnings("Convert2streamapi")
@TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1)
private void updateRecentApps(final boolean firstRefresh) {
    SharedPreferences pref = U.getSharedPreferences(this);
    final PackageManager pm = getPackageManager();
    final List<AppEntry> entries = new ArrayList<>();
    List<LauncherActivityInfo> launcherAppCache = new ArrayList<>();
    int maxNumOfEntries = U.getMaxNumOfEntries(this);
    int realNumOfPinnedApps = 0;
    boolean fullLength = pref.getBoolean("full_length", false);

    PinnedBlockedApps pba = PinnedBlockedApps.getInstance(this);
    List<AppEntry> pinnedApps = pba.getPinnedApps();
    List<AppEntry> blockedApps = pba.getBlockedApps();
    List<String> applicationIdsToRemove = new ArrayList<>();

    // Filter out anything on the pinned/blocked apps lists
    if (pinnedApps.size() > 0) {
        UserManager userManager = (UserManager) getSystemService(USER_SERVICE);
        LauncherApps launcherApps = (LauncherApps) getSystemService(LAUNCHER_APPS_SERVICE);

        for (AppEntry entry : pinnedApps) {
            boolean packageEnabled = launcherApps.isPackageEnabled(entry.getPackageName(),
                    userManager.getUserForSerialNumber(entry.getUserId(this)));

            if (packageEnabled)
                entries.add(entry);//from ww w .  j a v a  2s . c  om
            else
                realNumOfPinnedApps--;

            applicationIdsToRemove.add(entry.getPackageName());
        }

        realNumOfPinnedApps = realNumOfPinnedApps + pinnedApps.size();
    }

    if (blockedApps.size() > 0) {
        for (AppEntry entry : blockedApps) {
            applicationIdsToRemove.add(entry.getPackageName());
        }
    }

    // Get list of all recently used apps
    List<AppEntry> usageStatsList = realNumOfPinnedApps < maxNumOfEntries ? getAppEntries() : new ArrayList<>();
    if (usageStatsList.size() > 0 || realNumOfPinnedApps > 0 || fullLength) {
        if (realNumOfPinnedApps < maxNumOfEntries) {
            List<AppEntry> usageStatsList2 = new ArrayList<>();
            List<AppEntry> usageStatsList3 = new ArrayList<>();
            List<AppEntry> usageStatsList4 = new ArrayList<>();
            List<AppEntry> usageStatsList5 = new ArrayList<>();
            List<AppEntry> usageStatsList6;

            Intent homeIntent = new Intent(Intent.ACTION_MAIN);
            homeIntent.addCategory(Intent.CATEGORY_HOME);
            ResolveInfo defaultLauncher = pm.resolveActivity(homeIntent, PackageManager.MATCH_DEFAULT_ONLY);

            // Filter out apps without a launcher intent
            // Also filter out the current launcher, and Taskbar itself
            for (AppEntry packageInfo : usageStatsList) {
                if (hasLauncherIntent(packageInfo.getPackageName())
                        && !packageInfo.getPackageName().contains(BuildConfig.BASE_APPLICATION_ID)
                        && !packageInfo.getPackageName().equals(defaultLauncher.activityInfo.packageName))
                    usageStatsList2.add(packageInfo);
            }

            // Filter out apps that don't fall within our current search interval
            for (AppEntry stats : usageStatsList2) {
                if (stats.getLastTimeUsed() > searchInterval || runningAppsOnly)
                    usageStatsList3.add(stats);
            }

            // Sort apps by either most recently used, or most time used
            if (!runningAppsOnly) {
                if (sortOrder.contains("most_used")) {
                    Collections.sort(usageStatsList3, (us1, us2) -> Long.compare(us2.getTotalTimeInForeground(),
                            us1.getTotalTimeInForeground()));
                } else {
                    Collections.sort(usageStatsList3,
                            (us1, us2) -> Long.compare(us2.getLastTimeUsed(), us1.getLastTimeUsed()));
                }
            }

            // Filter out any duplicate entries
            List<String> applicationIds = new ArrayList<>();
            for (AppEntry stats : usageStatsList3) {
                if (!applicationIds.contains(stats.getPackageName())) {
                    usageStatsList4.add(stats);
                    applicationIds.add(stats.getPackageName());
                }
            }

            // Filter out the currently running foreground app, if requested by the user
            if (pref.getBoolean("hide_foreground", false)) {
                UsageStatsManager mUsageStatsManager = (UsageStatsManager) getSystemService(
                        USAGE_STATS_SERVICE);
                UsageEvents events = mUsageStatsManager.queryEvents(searchInterval, System.currentTimeMillis());
                UsageEvents.Event eventCache = new UsageEvents.Event();
                String currentForegroundApp = null;

                while (events.hasNextEvent()) {
                    events.getNextEvent(eventCache);

                    if (eventCache.getEventType() == UsageEvents.Event.MOVE_TO_FOREGROUND) {
                        if (!(eventCache.getPackageName().contains(BuildConfig.BASE_APPLICATION_ID)
                                && !eventCache.getClassName().equals(MainActivity.class.getCanonicalName())
                                && !eventCache.getClassName().equals(HomeActivity.class.getCanonicalName())
                                && !eventCache.getClassName()
                                        .equals(InvisibleActivityFreeform.class.getCanonicalName())))
                            currentForegroundApp = eventCache.getPackageName();
                    }
                }

                if (!applicationIdsToRemove.contains(currentForegroundApp))
                    applicationIdsToRemove.add(currentForegroundApp);
            }

            for (AppEntry stats : usageStatsList4) {
                if (!applicationIdsToRemove.contains(stats.getPackageName())) {
                    usageStatsList5.add(stats);
                }
            }

            // Truncate list to a maximum length
            if (usageStatsList5.size() > maxNumOfEntries)
                usageStatsList6 = usageStatsList5.subList(0, maxNumOfEntries);
            else
                usageStatsList6 = usageStatsList5;

            // Determine if we need to reverse the order
            boolean needToReverseOrder;
            switch (U.getTaskbarPosition(this)) {
            case "bottom_right":
            case "top_right":
                needToReverseOrder = sortOrder.contains("false");
                break;
            default:
                needToReverseOrder = sortOrder.contains("true");
                break;
            }

            if (needToReverseOrder) {
                Collections.reverse(usageStatsList6);
            }

            // Generate the AppEntries for TaskbarAdapter
            int number = usageStatsList6.size() == maxNumOfEntries
                    ? usageStatsList6.size() - realNumOfPinnedApps
                    : usageStatsList6.size();

            UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE);
            LauncherApps launcherApps = (LauncherApps) getSystemService(Context.LAUNCHER_APPS_SERVICE);

            final List<UserHandle> userHandles = userManager.getUserProfiles();

            for (int i = 0; i < number; i++) {
                for (UserHandle handle : userHandles) {
                    String packageName = usageStatsList6.get(i).getPackageName();
                    List<LauncherActivityInfo> list = launcherApps.getActivityList(packageName, handle);
                    if (!list.isEmpty()) {
                        // Google App workaround
                        if (!packageName.equals("com.google.android.googlequicksearchbox"))
                            launcherAppCache.add(list.get(0));
                        else {
                            boolean added = false;
                            for (LauncherActivityInfo info : list) {
                                if (info.getName()
                                        .equals("com.google.android.googlequicksearchbox.SearchActivity")) {
                                    launcherAppCache.add(info);
                                    added = true;
                                }
                            }

                            if (!added)
                                launcherAppCache.add(list.get(0));
                        }

                        AppEntry newEntry = new AppEntry(packageName, null, null, null, false);

                        newEntry.setUserId(userManager.getSerialNumberForUser(handle));
                        entries.add(newEntry);

                        break;
                    }
                }
            }
        }

        while (entries.size() > maxNumOfEntries) {
            try {
                entries.remove(entries.size() - 1);
                launcherAppCache.remove(launcherAppCache.size() - 1);
            } catch (ArrayIndexOutOfBoundsException e) {
                /* Gracefully fail */ }
        }

        // Determine if we need to reverse the order again
        if (U.getTaskbarPosition(this).contains("vertical")) {
            Collections.reverse(entries);
            Collections.reverse(launcherAppCache);
        }

        // Now that we've generated the list of apps,
        // we need to determine if we need to redraw the Taskbar or not
        boolean shouldRedrawTaskbar = firstRefresh;

        List<String> finalApplicationIds = new ArrayList<>();
        for (AppEntry entry : entries) {
            finalApplicationIds.add(entry.getPackageName());
        }

        if (finalApplicationIds.size() != currentTaskbarIds.size() || numOfPinnedApps != realNumOfPinnedApps)
            shouldRedrawTaskbar = true;
        else {
            for (int i = 0; i < finalApplicationIds.size(); i++) {
                if (!finalApplicationIds.get(i).equals(currentTaskbarIds.get(i))) {
                    shouldRedrawTaskbar = true;
                    break;
                }
            }
        }

        if (shouldRedrawTaskbar) {
            currentTaskbarIds = finalApplicationIds;
            numOfPinnedApps = realNumOfPinnedApps;

            UserManager userManager = (UserManager) getSystemService(USER_SERVICE);

            int launcherAppCachePos = -1;
            for (int i = 0; i < entries.size(); i++) {
                if (entries.get(i).getComponentName() == null) {
                    launcherAppCachePos++;
                    LauncherActivityInfo appInfo = launcherAppCache.get(launcherAppCachePos);
                    String packageName = entries.get(i).getPackageName();

                    entries.remove(i);

                    AppEntry newEntry = new AppEntry(packageName, appInfo.getComponentName().flattenToString(),
                            appInfo.getLabel().toString(), IconCache.getInstance(TaskbarService.this)
                                    .getIcon(TaskbarService.this, pm, appInfo),
                            false);

                    newEntry.setUserId(userManager.getSerialNumberForUser(appInfo.getUser()));
                    entries.add(i, newEntry);
                }
            }

            final int numOfEntries = Math.min(entries.size(), maxNumOfEntries);

            handler.post(() -> {
                if (numOfEntries > 0 || fullLength) {
                    ViewGroup.LayoutParams params = scrollView.getLayoutParams();
                    DisplayMetrics metrics = getResources().getDisplayMetrics();
                    int recentsSize = getResources().getDimensionPixelSize(R.dimen.icon_size) * numOfEntries;
                    float maxRecentsSize = fullLength ? Float.MAX_VALUE : recentsSize;

                    if (U.getTaskbarPosition(TaskbarService.this).contains("vertical")) {
                        int maxScreenSize = metrics.heightPixels - U.getStatusBarHeight(TaskbarService.this)
                                - U.getBaseTaskbarSize(TaskbarService.this);

                        params.height = (int) Math.min(maxRecentsSize, maxScreenSize)
                                + getResources().getDimensionPixelSize(R.dimen.divider_size);

                        if (fullLength && U.getTaskbarPosition(this).contains("bottom")) {
                            try {
                                Space whitespace = (Space) layout.findViewById(R.id.whitespace);
                                ViewGroup.LayoutParams params2 = whitespace.getLayoutParams();
                                params2.height = maxScreenSize - recentsSize;
                                whitespace.setLayoutParams(params2);
                            } catch (NullPointerException e) {
                                /* Gracefully fail */ }
                        }
                    } else {
                        int maxScreenSize = metrics.widthPixels - U.getBaseTaskbarSize(TaskbarService.this);

                        params.width = (int) Math.min(maxRecentsSize, maxScreenSize)
                                + getResources().getDimensionPixelSize(R.dimen.divider_size);

                        if (fullLength && U.getTaskbarPosition(this).contains("right")) {
                            try {
                                Space whitespace = (Space) layout.findViewById(R.id.whitespace);
                                ViewGroup.LayoutParams params2 = whitespace.getLayoutParams();
                                params2.width = maxScreenSize - recentsSize;
                                whitespace.setLayoutParams(params2);
                            } catch (NullPointerException e) {
                                /* Gracefully fail */ }
                        }
                    }

                    scrollView.setLayoutParams(params);

                    taskbar.removeAllViews();
                    for (int i = 0; i < entries.size(); i++) {
                        taskbar.addView(getView(entries, i));
                    }

                    isShowingRecents = true;
                    if (shouldRefreshRecents && scrollView.getVisibility() != View.VISIBLE) {
                        if (firstRefresh)
                            scrollView.setVisibility(View.INVISIBLE);
                        else
                            scrollView.setVisibility(View.VISIBLE);
                    }

                    if (firstRefresh && scrollView.getVisibility() != View.VISIBLE)
                        new Handler().post(() -> {
                            switch (U.getTaskbarPosition(TaskbarService.this)) {
                            case "bottom_left":
                            case "bottom_right":
                            case "top_left":
                            case "top_right":
                                if (sortOrder.contains("false"))
                                    scrollView.scrollTo(0, 0);
                                else if (sortOrder.contains("true"))
                                    scrollView.scrollTo(taskbar.getWidth(), taskbar.getHeight());
                                break;
                            case "bottom_vertical_left":
                            case "bottom_vertical_right":
                            case "top_vertical_left":
                            case "top_vertical_right":
                                if (sortOrder.contains("false"))
                                    scrollView.scrollTo(taskbar.getWidth(), taskbar.getHeight());
                                else if (sortOrder.contains("true"))
                                    scrollView.scrollTo(0, 0);
                                break;
                            }

                            if (shouldRefreshRecents) {
                                scrollView.setVisibility(View.VISIBLE);
                            }
                        });
                } else {
                    isShowingRecents = false;
                    scrollView.setVisibility(View.GONE);
                }
            });
        }
    } else if (firstRefresh || currentTaskbarIds.size() > 0) {
        currentTaskbarIds.clear();
        handler.post(() -> {
            isShowingRecents = false;
            scrollView.setVisibility(View.GONE);
        });
    }
}

From source file:com.dycody.android.idealnote.ListFragment.java

/**
 * SearchView initialization. It's a little complex because it's not using SearchManager but is implementing on its
 * own.//  w ww  .  jav a2 s .c o  m
 */
@SuppressLint("NewApi")
private void initSearchView(final Menu menu) {

    // Prevents some mysterious NullPointer on app fast-switching
    if (mainActivity == null)
        return;

    // Save item as class attribute to make it collapse on drawer opening
    searchMenuItem = menu.findItem(R.id.menu_search);

    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) mainActivity.getSystemService(Context.SEARCH_SERVICE);
    searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_search));
    searchView.setSearchableInfo(searchManager.getSearchableInfo(mainActivity.getComponentName()));
    searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH);

    // Expands the widget hiding other actionbar icons
    searchView.setOnQueryTextFocusChangeListener((v, hasFocus) -> setActionItemsVisibility(menu, hasFocus));

    MenuItemCompat.setOnActionExpandListener(searchMenuItem, new MenuItemCompat.OnActionExpandListener() {

        boolean searchPerformed = false;

        @Override
        public boolean onMenuItemActionCollapse(MenuItem item) {
            // Reinitialize notes list to all notes when search is collapsed
            searchQuery = null;
            if (searchLayout.getVisibility() == View.VISIBLE) {
                toggleSearchLabel(false);
            }
            mainActivity.getIntent().setAction(Intent.ACTION_MAIN);
            initNotesList(mainActivity.getIntent());
            mainActivity.supportInvalidateOptionsMenu();
            return true;
        }

        @Override
        public boolean onMenuItemActionExpand(MenuItem item) {

            searchView.setOnQueryTextListener(new OnQueryTextListener() {
                @Override
                public boolean onQueryTextSubmit(String arg0) {

                    return prefs.getBoolean("settings_instant_search", false);
                }

                @Override
                public boolean onQueryTextChange(String pattern) {

                    if (prefs.getBoolean("settings_instant_search", false) && searchLayout != null
                            && searchPerformed && mFragment.isAdded()) {
                        searchTags = null;
                        searchQuery = pattern;
                        NoteLoaderTask.getInstance().execute("getNotesByPattern", pattern);
                        return true;
                    } else {
                        searchPerformed = true;
                        return false;
                    }
                }
            });
            return true;
        }
    });
}

From source file:info.papdt.blacklight.ui.main.MainActivity.java

@Binded
public void muser() {
    Intent i = new Intent();
    i.setAction(Intent.ACTION_MAIN);
    i.setClass(this, LoginActivity.class);
    i.putExtra("multi", true);
    startActivityForResult(i, REQUEST_LOGIN);
}

From source file:info.papdt.blacklight.ui.main.MainActivity.java

@Override
public void onClick(View v) {
    Intent i = new Intent();
    i.setAction(Intent.ACTION_MAIN);
    i.setClass(this, NewPostActivity.class);
    startActivity(i);/*  w w w. j ava  2  s.co  m*/
}

From source file:org.sipdroid.sipua.ui.Receiver.java

static Intent createHomeDockIntent() {
    Intent intent = new Intent(Intent.ACTION_MAIN, null);
    if (docked == EXTRA_DOCK_STATE_CAR) {
        intent.addCategory(CATEGORY_CAR_DOCK);
    } else if (docked == EXTRA_DOCK_STATE_DESK) {
        intent.addCategory(CATEGORY_DESK_DOCK);
    } else {/*from   ww w.j  a  v  a2 s.c o m*/
        return null;
    }

    ActivityInfo ai = intent.resolveActivityInfo(mContext.getPackageManager(), PackageManager.GET_META_DATA);
    if (ai == null) {
        return null;
    }

    if (ai.metaData != null && ai.metaData.getBoolean(METADATA_DOCK_HOME)) {
        intent.setClassName(ai.packageName, ai.name);
        return intent;
    }

    return null;
}

From source file:com.allwinner.theatreplayer.launcher.activity.LaunchActivity.java

@Override
public void onClick(View view) {
    CellInfo cellInfo = (CellInfo) view.getTag();

    //      Log.i("jim", "1111111111111=======cellInfo.packageName = "+cellInfo.packageName);

    if (cellInfo != null && mLauncherModel != null) {
        //         Log.i("jim", "22222222222=======cellInfo.packageName = "+cellInfo.packageName);
        if (cellInfo.packageName.equals(Constants.PACKAGE_QQ)
                && SharedPreUtil.isFirstRunQQ(Constants.PACKAGE_QQ)) {
            LauncherApp.gIsFirstRunQQ = true;
            SharedPreUtil.saveQQVersionNum(Constants.PACKAGE_QQ);
            if (!OrientatorService.mIsClose) {
                OrientatorService.closeOrientatorMode();
            }//from   w w  w  . ja va 2  s  . c  o  m
        } else if (cellInfo.portrait.equals("true")) {
            if (LoadApplicationInfo.isInstalled(this, cellInfo.packageName)) {
                if (!OrientatorService.mIsClose) {
                    OrientatorService.closeOrientatorMode();
                }
            }

        } else {
            if (OrientatorService.mIsClose) {
                OrientatorService.forceLandscapeMode();
            }
        }
        //         Log.i("jim", "3333333=======cellInfo.packageName = "+cellInfo.packageName);
        if (cellInfo.packageName.equals(Constants.PACKAGE_VODTYPE)) {
            mLauncherModel.startVstByType(cellInfo.className, Constants.PACKAGE_VODTYPE);
            //            Log.i("jim", "4444444444444=======cellInfo.packageName = "+cellInfo.packageName);

        } else if (cellInfo.packageName.equals(Constants.PACKAGE_VST_RECORD)
                || cellInfo.packageName.equals(Constants.PACKAGE_VST_SETTING)) {
            mLauncherModel.startActivityByAction(cellInfo.packageName);
            //            Log.i("jim", "5555555555=======cellInfo.packageName = "+cellInfo.packageName);
        } else if (cellInfo.packageName.equals(Constants.PACKAGE_GALLERY)) {
            if (cellInfo.className.equals(Constants.PACKAGE_CAMERA)) {
                //               Log.i("jim", "66666666666=======cellInfo.packageName = "+cellInfo.packageName);
                try {
                    ComponentName componentName = new ComponentName(Constants.PACKAGE_GALLERY,
                            Constants.PACKAGE_CAMERA);
                    Intent intent = new Intent();
                    intent.setComponent(componentName);
                    startActivity(intent);
                } catch (Exception e) {
                    Toast.makeText(this, cellInfo.packageName + " not found", Toast.LENGTH_SHORT).show();
                }
            } else {
                mLauncherModel.startThirdApk(Constants.PACKAGE_GALLERY, cellInfo.className);
                //               Log.i("jim", "7777777777777777=======cellInfo.packageName = "+cellInfo.packageName);
            }

        } else if (cellInfo.packageName.equals(Constants.PACKAGE_OCOCCI_VIDEO)) {
            //            Log.i("jim", "AAAAAAAAAAAA=======cellInfo.packageName = "+cellInfo.packageName);
            //if(cellInfo.className.equals("tv")){               

            Intent intent = new Intent(Intent.ACTION_MAIN);
            intent.addCategory(Intent.CATEGORY_LAUNCHER);
            ComponentName cn = new ComponentName(Constants.PACKAGE_OCOCCI_VIDEO,
                    "com.ococci.video.activity.WelcomeActivity");
            intent.putExtra("video_request_flag", cellInfo.className);
            intent.setComponent(cn);
            startActivity(intent);

            //}
        } else if (cellInfo.packageName.equals(Constants.PACKAGE_HEALTH)) {
            Intent intent = new Intent();
            intent.setAction("com.vst.allwinner.intent.action.ChannelActivity");
            intent.putExtra("cid", cellInfo.className);//
            startActivity(intent);
        } else if (cellInfo.packageName.equals(Constants.PACKAGE_CHILDREN)) {

            Intent intent = new Intent();
            intent.setAction("myvst.intent.action.children.list.v2");
            intent.putExtra("uuid", "424C4C7347456F6F1CF462");
            intent.putExtra("playerIndex", 1);
            startActivity(intent);
        } else if (cellInfo.className != null && !cellInfo.className.equals("")) {
            mLauncherModel.startActivity(cellInfo.packageName, cellInfo.className);

            //            Log.i("jim", "88888888888=======cellInfo.packageName = "+cellInfo.packageName);
        } else if (cellInfo.packageName.equals(Constants.PACKAGE_LIVE)) {
            //            Log.i("jim", "999999999999999=======cellInfo.packageName = "+cellInfo.packageName);
            if (mLiveAppAuthorized) {
                mLauncherModel.startThirdApk(cellInfo.packageName);
            } else {
                CustomToast.showToast(this, R.string.live_unauthorized);
            }
        } else if (cellInfo.packageName.equals("com.allwinner.theatreplayer.launcher.AllAppActivity")) {
            //             Log.i("Trim", cellInfo.packageName);

            Intent intent = new Intent(LaunchActivity.this, LocalAppActivity.class);
            startActivity(intent);
        } else if (cellInfo.packageName.equals("com.android.settings")) {
            //R16settings
            if (Utils.isPkgInstalled(LaunchActivity.this, Constants.PACKAGE_SETTINGS)) {
                mLauncherModel.startThirdApk(Constants.PACKAGE_SETTINGS);
            } else {
                mLauncherModel.startThirdApk(cellInfo.packageName);
            }
        } else {
            //            Log.i("Trim", cellInfo.packageName);
            mLauncherModel.startThirdApk(cellInfo.packageName);
        }
    }
}

From source file:co.taqat.call.assistant.AssistantActivity.java

public void restartApplication() {
    mPrefs.firstLaunchSuccessful();//from  w w w. java 2  s .  co  m

    Intent mStartActivity = new Intent(this, LinphoneLauncherActivity.class);
    PendingIntent mPendingIntent = PendingIntent.getActivity(this, (int) System.currentTimeMillis(),
            mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
    AlarmManager mgr = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
    mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 500, mPendingIntent);

    stopService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class));
    android.os.Process.killProcess(android.os.Process.myPid());
}

From source file:org.sipdroid.sipua.ui.Receiver.java

public static Intent createHomeIntent() {
    Intent intent = createHomeDockIntent();
    if (intent != null) {
        try {// w w w. j a v a  2  s.  com
            return intent;
        } catch (ActivityNotFoundException e) {
        }
    }
    intent = new Intent(Intent.ACTION_MAIN, null);
    intent.addCategory(Intent.CATEGORY_HOME);
    return intent;
}