get Activity Manager - Android android.app

Android examples for android.app:ActivityManager

Description

get Activity Manager

Demo Code

import android.app.ActivityManager;
import android.app.Service;
import android.content.Context;
import android.os.PowerManager;

public class Main{

    public static ActivityManager getActivityManager(Context context) {

        try {/*from   ww w .j av a 2 s  . co m*/
            return (ActivityManager) context
                    .getSystemService(Service.ACTIVITY_SERVICE);
        } catch (SecurityException e) {
        } catch (ClassCastException e) {
        }

        return null;

    }

}

Related Tutorials