HTTP REST
웹서버 구축시 사용되는 웹서비스 이다.

Get요청
우선 메니페시트 파일에
 <uses-permission android:name="android.permission.INTERNET"/>
꼭 추가하시고!!

 try{
         HttpClient client=new DefaultHttpClient();
         HttpGet get=new HttpGet();
         get.setURI(new URI("http://rlqks132.tistory.com/"));
         HttpResponse resp=client.execute(get);
         BufferedReader br=new BufferedReader(new InputStreamReader(resp.getEntity().getContent()));
         
         String str=null;
         StringBuffer sb=new StringBuffer();
         while((str=br.readLine())!=null){
          sb.append(str).append("\n");
         }
         br.close();
         TextView tv=(TextView)findViewById(R.id.textView);
         tv.setText(sb.toString());
        }catch(Exception e){
        }

예제 입니다.^^

'IT 공부 > 안드로이드' 카테고리의 다른 글

JSON을 활용한 검색기  (2) 2012.02.25
XML을 활용한 RSS리더기  (1) 2012.02.25
Activity 화면창  (3) 2011.11.03
Animation effect  (1) 2011.11.03
화면 변화  (1) 2011.11.02

+ Recent posts