마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

BitmapFactory.decodeStream(in);다음 소스를 가지고 화면 갱신하는방법 좀 알려주세요

0 추천
public class Tttttt extends Activity {
 
 public static final String SERV_IP = "xxxxxxxxxxxxxxxx아이피주소";
 public static final int PORT = xxxx포트번호;

 ViewFlipper flipper;
 
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  
  
  
   Socket sock=null;
   
   try {
    ImageView downimage = (ImageView)findViewById(R.id.imageView1);
    
     sock = new Socket(SERV_IP, PORT);
    
     InputStream in = sock.getInputStream();
     Bitmap bitmap = BitmapFactory.decodeStream(in);
 

     downimage.setImageBitmap(bitmap);
     downimage.setScaleType(ScaleType.FIT_XY);
    

     
   } catch (UnknownHostException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }   finally {
   try {
        sock.close();
      } catch (IOException e) {
       
      }
   }
 }

 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
  // Inflate the menu; this adds items to the action bar if it is present.
  getMenuInflater().inflate(R.menu.ttttt, menu);
  return true;
 }

}

 

//////////////////////////////

위에 소스를 가지고 이미지 출력되는 부분을 계속 갱신시켜주고 싶은데

이거 어떻게 하는지좀 알려주세요

만약 for문이나 while문을 써야한다면 어떻게 쓰는지 알려주세요

invalidate()를 사용할수있는지도 알고싶네요
익명사용자 님이 2013년 5월 2일 질문
2013년 5월 2일 수정

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...