长按home键可以出来最近使用的应用程序。具体到代码需要用反射来完成,具体代码如下:
public void recentApp() {
try {
Class<?> localClass1 = Class.forName("android.os.ServiceManager");
IBinder localIBinder = (IBinder) localClass1.getMethod(
"getService", new Class[] { String.class }).invoke(
localClass1, new Object[] { "statusbar" });
Class<?> localClass2 = Class.forName(localIBinder
.getInterfaceDescriptor());
Object localObject = localClass2.getClasses()[0].getMethod(
"asInterface", new Class[] { IBinder.class }).invoke(null,
new Object[] { localIBinder });
Method localMethod = localClass2.getMethod("toggleRecentApps",
new Class[0]);
localMethod.setAccessible(true);
localMethod.invoke(localObject, new Object[0]);
return;
} catch (Exception localException) {
}
}