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
댓글 없음:
댓글 쓰기