Page 1090 - 3-3
P. 1090

public void onClick(View view) {
                          TextView tv1 = (TextView)findViewById(R.id.iptxt);
                          wifi = cManager.getNetworkInfo(TYPE_WIFI);              // WIFI  연결 정보
                          // WIFI 가 연결되어 있을 경우현재 할당받은 IP               주소를 iptxt TextView    에 표시
                          if (wifi.isConnected()) {
                              WifiManager wManager = (WifiManager)
          getApplicationContext().getSystemService(Context.WIFI_SERVICE);
                              WifiInfo info = wManager.getConnectionInfo();
                              tv1.setText("IP Address: " + Formatter.formatIpAddress(info.getIpAddress()));
                          } else {// WIFI 가 연결되어 있지 않을 경우 Disconnect           를 iptxt TextView 에 표시
                              tv1.setText("Disconnected");
                          }


                      }
                  });
                  // carex  버튼 클릭 시 동작 정의
                  btn3.setOnClickListener(new View.OnClickListener(){
                      public void onClick(View view) {
                          // TowerSmarttower Activity  시작
                        Intent intent = (new Intent(getApplicationContext(),TowerSmarttower.class));
                          startActivity(intent);
                          finish();


                      }
                  });
              }


              class Connecttower extends Thread {
                  EditText et1 = (EditText) findViewById(R.id.ip);
                  public void run() {


                      try {
                          //  메인 UI Thread  의 Message queue   에 실행할 Runnable      객체를 전달
                          //  메인 UI Thread  의 Looper 에 의해 Runnable     객체가 실행됨
                          mHandler.post(new Runnable() {
                              String ip = et1.getText().toString();
                              @Override
                              public void run() {
                                  setToast(" 연결된 IP:" + ip + "Port:" + "8002");
                                  // TowerSmarttower Activity  시작을 위한 Intent
                                  Intent Intenttower = new Intent(TowerMainActivity.this,
          TowerSmarttower.class);
                                  // IP  주소를 Extra  로 전달
                                  Intenttower.putExtra("ip", ip);
                                  // 액티비티 시작!


                                                        - 1090 -
   1085   1086   1087   1088   1089   1090   1091   1092   1093   1094   1095