Page 849 - 3-3
P. 849

}
                                   else if (flag == 1) { //  서버에서 1  값을 수신 받을 경우
                                           String str = null;
                                           byte[] buff = new byte[64]; // byte 단위로 보내주기위해 변수생성
                                           int read = 0;
                                       read = socketIn.read(buff, 0 , 64); //  한글이름 값을 받아옴
                                       str = new String(buff);// str  변수에 저장
                                       Toast.makeText(getBaseContext(),           " 로그인           되었습니다",
               Toast.LENGTH_SHORT).show();
                                       // Office_menu 로 가는 intent  생성
                                       Intent intent = new Intent(getApplicationContext(), Office_menu.class);
                                       intent.putExtra("name",str);
                                       intent.putExtra("IP",IP);
                                       intent.putExtra("WebIP", WebIP);
                                       intent.putExtra("PORT",PORT);
                                       startActivity(intent); //  화면전환
                                       connect.close(); //  소켓통신 종료
                                   }
                               } catch (IOException e) { //  서버에 연결할수 없을경우
                                   Toast.makeText(getBaseContext(),          " 연결할         수        없습니다",
               Toast.LENGTH_SHORT).show();
                               }
                           }
                       });
                       exit.setOnClickListener(new View.OnClickListener() {
                           @Override
                           public void onClick(View v) { //  종료 버튼
                               Toast.makeText(getBaseContext(),                              " 종료되었습니다",
               Toast.LENGTH_SHORT).show();
                               finish(); // Activity  종료
                           }
                       });
                   }
                   @Override
                   public void onBackPressed() {
                       //  뒤로가기 버튼 메소드를 불러와 뒤로가기를 못하게함
                   }
               }


                  <Office_menu.java> (  스마트 오피스 메뉴 )


               package com.helloworld.smartschool; //  패키지를 불러옴
               import android.content.DialogInterface; //  다이얼로그 인터페이스를 불러옴
               import android.content.Intent; //  화면 전환을 위해 인탠트를 불러옴
               import android.os.AsyncTask; //  비동기 통신을 위해 불러옴


                                                          - 849 -
   844   845   846   847   848   849   850   851   852   853   854