start Service using Intent by service type Class - Android Intent

Android examples for Intent:Open App

Description

start Service using Intent by service type Class

Demo Code


//package com.java2s;

import android.app.Service;
import android.content.Context;
import android.content.Intent;

public class Main {
    public static void startService(Context context,
            Class<? extends Service> type) {
        context.startService(new Intent(context, type));
    }//w w w. j  a va 2  s. c  om
}

Related Tutorials