Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.ServiceConnection;

public class Main {
    private static void bindToService(Intent intent, Context context, ServiceConnection callback) {
        Context realActivity = context.getApplicationContext();
        if (realActivity == null) {
            realActivity = context;
        }
        ContextWrapper cw = new ContextWrapper(realActivity);
        cw.startService(intent);
        cw.bindService(intent, callback, Context.BIND_AUTO_CREATE);
    }
}