Skip to Main Content
Head First Android Development: 개념과 구조를 머릿속에 그려주는 안드로이드 개발 입문서(개정판)
book

Head First Android Development: 개념과 구조를 머릿속에 그려주는 안드로이드 개발 입문서(개정판)

by 우정은, 돈 그리피스, 데이비드 그리피스
July 2018
Beginner content levelBeginner
936 pages
26h 17m
Korean
Hanbit Media, Inc.
Content preview from Head First Android Development: 개념과 구조를 머릿속에 그려주는 안드로이드 개발 입문서(개정판)
지금 여기예요
4
817
바운드 서비스와 권한
ServiceConnection 생성하기
ServiceConnection
은 액티비티와 서비스를 연결할 수 있도록
해주는 인터페이스입니다. 이는
onServiceConnected
()
onServiceDisconnected
()
두 개의 메서드를 제공합니다.
onServiceConnected
()
메서드는 서비스와 연결되었을 때 호출되며
onServiceDisconnected
()
는 서비스와 연결이 끊어졌을 때 호출됩니다.
MainActivity
ServiceConnection
을 추가해야 합니다. 다음은 기본
코드입니다. 여러분의
MainActivity
.
java
코드를 다음처럼 바꾸세요.
package com.hfad.odometer;
import android.app.Activity;
import android.os.Bundle;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.content.ComponentName;
public class MainActivity extends Activity {
private ServiceConnection connection = new ServiceConnection() {
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Head First C# (개정3판): 상상을 초월하는 객체지향 C# 학습법

Head First C# (개정3판): 상상을 초월하는 객체지향 C# 학습법

최길우, 앤드류 스텔만, 제니퍼 그린

Publisher Resources

ISBN: 9791162240953