Java tutorial
//package com.java2s; import android.content.Context; import android.content.Intent; public class Main { public static boolean stopRunningService(Context ctx, String className) { Intent intent_service = null; boolean ret = false; try { intent_service = new Intent(ctx, Class.forName(className)); } catch (Exception e) { e.printStackTrace(); } if (intent_service != null) { ret = ctx.stopService(intent_service); } return ret; } }