다음 URL에서 무료로 제공하니 안심하시고 Download 하세요.
윗 그림의 붉은선의「Download the SDK」라고 하는 링크를 클릭해 주세요.
붉은선의 Continue를 선택하시고
붉은선의 적당한 Version를 다운받아 하드의 적당한 장소에 보존해 주세요.
윗 그림의 붉은선의「Download the SDK」라고 하는 링크를 클릭해 주세요.
붉은선의 Continue를 선택하시고
http://helloandroid.com
package com.google.android.ip;
import java.net.InetAddress;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class Ip extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
Button cmd_ip = (Button)this.findViewById(R.id.widget23);
final EditText txt_box =(EditText)this.findViewById(R.id.widget24 );
cmd_ip.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
InetAddress Local_ip = null;
try {
InetAddress myIp = null;
myIp = InetAddress.getByName("LocalHost");
//myIp = InetAddress.getByName("www.naver.com");
txt_box.setText(myIp.getHostAddress());
} catch (Exception e) {
}
}
});
}
}
I get ip in google android
소스입니다.
좀 허접해서 창피하지만 도움 되었으면 좋겠습니다.
칼라부분이 수정또는 추가 된 부분이고요 녹색부분은 삭제해도 잘 돌아 가요..
나중에 좋은 결과있으시면 소주한잔 사세요...ㅎㅎㅎㅎㅎ
아 그리고 "손맛" 영어로 어떻게 표현하면 좋을까요? 이글 보시는 분들 지발 좀 답 좀 주세요..
package com.google.android.samples.graphics;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
//Need the following import to get access to the app resources, since this
//class is in a sub-package.
/**
* Demonstrates the handling of touch screen events to implement a simple
* painting app.
*/
public class TouchPaint extends Activity {
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(new MyView(this));
}
public class MyView extends View {
Bitmap mBitmap;
Canvas mCanvas;
private final Rect mRect = new Rect();
private final Paint mPaint;
private boolean mCurDown;
private int mCurX;
private int mCurY;
private int mOCurX=0;
private int mOCurY=0;
private float mCurPressure;
private float mCurSize;
private int mCurWidth;
public MyView(Context c) {
super(c);
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setARGB(255, 255, 255, 255);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
int curW = mBitmap != null ? mBitmap.width() : 0;
int curH = mBitmap != null ? mBitmap.height() : 0;
if (curW >= w && curH >= h) {
return;
}
if (curW < w) curW = w;
if (curH < h) curH = h;
Bitmap newBitmap = Bitmap.createBitmap(curW, curH, false);
Canvas newCanvas = new Canvas();
newCanvas.setDevice(newBitmap);
if (mBitmap != null) {
newCanvas.drawBitmap(mBitmap, 0, 0, null);
}
mBitmap = newBitmap;
mCanvas = newCanvas;
}
@Override
protected void onDraw(Canvas canvas) {
if (mBitmap != null) {
canvas.drawBitmap(mBitmap, 0, 0, null);
}
}
@Override
public boolean onMotionEvent(MotionEvent event) {
int action = event.getAction();
mCurDown = action == MotionEvent.ACTION_DOWN
|| action == MotionEvent.ACTION_MOVE;
mCurX = (int)event.getX();
mCurY = (int)event.getY();
if(action == MotionEvent.ACTION_DOWN && action != MotionEvent.ACTION_MOVE){
mOCurX =mCurX;
mOCurY =mCurY;
}
mCurPressure = event.getPressure();
mCurSize = event.getSize();
mCurWidth = (int)(mCurSize*(getWidth()/3));
if (mCurWidth < 1) mCurWidth = 1;
if (mCurDown && mBitmap != null) {
int pressureLevel = (int)(mCurPressure*255);
mPaint.setARGB(pressureLevel, 0, 255, 255);
//mCanvas.drawCircle(mCurX, mCurY, mCurWidth, mPaint);
mCanvas.drawPoint(mCurX, mCurY, mPaint);
mCanvas.drawLine(mOCurX, mOCurY, mCurX, mCurY,mPaint);
mOCurX =mCurX;
mOCurY =mCurY;
// mRect.set(mCurX-mCurWidth-2, mCurY-mCurWidth-2,
// mCurX+mCurWidth+2, mCurY+mCurWidth+2);
//invalidate(mRect);
invalidate();
}
return true;
}
}
}