Ubuntu2017.04.21 10:05
미러 서버 변경

 

//백업

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

 

//sed 명령어로 다음으로 변경

sudo sed -i 's/kr.archive.ubuntu.com/ftp.daum.net/g' /etc/apt/sources.list

 

'Ubuntu' 카테고리의 다른 글

Python3 + pip 설치  (0) 2017.04.21
# not upgraded  (0) 2017.04.21
우분투 nvidia 설정 & Black Screen  (0) 2017.04.21
DNS 서버 변경(KT로 변경)  (0) 2017.04.21
Unable to lock the administration directory (/var/lib/dpkg/)  (0) 2017.04.21
미러 서버 변경  (0) 2017.04.21
Posted by 곰대생
2017.03.09 15:56

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

Android2016.10.10 17:05

MainActivity

 

package com.tathink.a170m3.messagetest;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.view.View;

public class MainActivity extends Activity {

Messenger mService = null;
boolean mBound;

private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
mService = new Messenger(service);
mBound = true;
}

public void onServiceDisconnected(ComponentName className) {
mService = null;
mBound = false;
}
};

public void sayHello(View v) {
if (!mBound) return;
Message msg = Message.obtain(null, MessageService.MSG_SAY_HELLO, 0, 0);
try {
mService.send(msg);
} catch (RemoteException e) {
e.printStackTrace();
}
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

@Override
protected void onStart() {
super.onStart();
// Bind to the service
bindService(new Intent(this, MessageService.class), mConnection,
Context.BIND_AUTO_CREATE);
}

@Override
protected void onStop() {
super.onStop();
// Unbind from the service
if (mBound) {
unbindService(mConnection);
mBound = false;
}
}

public void onClickBtn(View view) {
sayHello(view);
}
}

 

 

 

MessageService

 

package com.tathink.a170m3.messagetest;

import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.widget.Toast;

/**
* Created by MSI on 2016-10-10.
*/

public class MessageService extends Service {
static final int MSG_SAY_HELLO = 1;
class IncomingHandler extends Handler {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_SAY_HELLO:
Toast.makeText(getApplicationContext(), "hello!", Toast.LENGTH_SHORT).show();
break;
default:
super.handleMessage(msg);
}
}
}

final Messenger mMessenger = new Messenger(new IncomingHandler());
@Override
public IBinder onBind(Intent intent) {
Toast.makeText(getApplicationContext(), "binding", Toast.LENGTH_SHORT).show();
return mMessenger.getBinder();
}
}
Posted by 곰대생

티스토리 툴바