None of the solutions here is working for me..
I got it working by using the below code
PackageManager pm = getPackageManager();
Intent i = new Intent("android.intent.action.MAIN");
i.addCategory("android.intent.category.HOME");
List<ResolveInfo> lst = pm.queryIntentActivities(i, 0);
if (lst != null) {
for (ResolveInfo resolveInfo : lst) {
try {
Intent home = new Intent("android.intent.action.MAIN");
home.addCategory("android.intent.category.HOME");
home.setClassName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name);
startActivity(home);
break;
} catch (Throwable t) {
t.printStackTrace();
}
}
}
Got it from: https://stackoverflow.com/a/16483596/1241783
Hope this helps someone