Java tutorial
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Method; import android.content.Context; public class Main { public static boolean collapseStatusBar(Context c) { try { Object service = c.getSystemService("statusbar"); Class<?> claz = Class.forName("android.app.StatusBarManager"); Method collapse; try { collapse = claz.getMethod("collapse"); collapse.setAccessible(true); collapse.invoke(service); } catch (Exception e) { try { collapse = claz.getMethod("collapsePanels"); collapse.setAccessible(true); collapse.invoke(service); } catch (Exception err) { return false; } } } catch (Exception e) { return false; } return true; } }