Page 215 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 215
// 앱이 실행될때 NFC 어댑터를 활성화 한다
if( mNfcAdapter != null )
mNfcAdapter.enableForegroundDispatch(this, mPendingIntent, mIntentFilters,
mNFCTechLists);
}
public void onPause() {
super.onPause();
// 앱이 종료될때 NFC 어댑터를 비활성화 한다
if( mNfcAdapter != null )
mNfcAdapter.disableForegroundDispatch(this);
}
@Override
public void onClick(View v) { //얘가 위에서 this로 넣어준 클릭 했을때의 동작 지정
switch (v.getId())
{
case R.id.viewtent:
Intent view = new Intent(Program.this,webview.class);
startActivity(view);
break;
}
}
@Override
public void run() { //얘가 t스레드에서 하는일
try {
sock = new Socket(ip, port); //전의 액티비티에서 받아온 ip와 port값으로 소켓을
연결한다.
din = new DataInputStream(sock.getInputStream()); //받아온거
dout = new DataOutputStream(sock.getOutputStream()); //보내는거
while(true) {
str = din.readUTF();
- 208 -