'Android'에 해당되는 글 2건

  1. 2010/10/07 android : 네트워크 상태 보기 (1)
  2. 2010/06/30 상속받은 View 를 xml 레이아웃에 추가하기 (3)
안드로이드에서 네트워크를 이용하는 어플인 경우, 현재 네트워크 상태를 다음과 같이 체크 할 수 있다.




* 다음은 안드로이드 레퍼런스 사이트에서 일부 발췌.

public boolean isAvailable ()

Since: API Level 1

Indicates whether network connectivity is possible. A network is unavailable when a persistent or semi-persistent condition prevents the possibility of connecting to that network. Examples include

  • The device is out of the coverage area for any network of this type.
  • The device is on a network other than the home network (i.e., roaming), and data roaming has been disabled.
  • The device's radio is turned off, e.g., because airplane mode is enabled.
Returns
  • true if the network is available, false otherwise

public boolean isConnected ()

Since: API Level 1

Indicates whether network connectivity exists and it is possible to establish connections and pass data.

Returns
  • true if network connectivity exists, false otherwise.



* Manifest 에서 ACCESS_NETWORK_STATE 권한을 설정해야 함.

Trackback Address :: http://seirion.com/trackback/203 관련글 쓰기

댓글을 달아 주세요

  1. 바보세룐 2010/12/03 22:45 Address Modify/Delete Reply

    3g 와 Wi-Fi 를 모두 끄면 netInfo 에 null 이 날라온다. 이거도 체크 해야 함.

XML 레이아웃에 본인이 작성한 View 를 넣고자 할 때,


 
AnotherView 클래스에서는 생성자를 오버로딩 하면 된다.



여기서 만약, 파라미터 2개짜리인 생성자를 오버로딩 하지 않으면 안 좋은 일이 일어난다.
궁금하다면 직접 해 보시라 ~

Trackback Address :: http://seirion.com/trackback/187 관련글 쓰기

댓글을 달아 주세요

  1. 바보세룐 2010/06/30 20:20 Address Modify/Delete Reply

    이거 땜에 몇 시간 캐 삽질 ㅠㅠ

  2. 흰둥이안뇽 2011/09/05 14:25 Address Modify/Delete Reply

    ;;; 이거 ..
    <view class="com.seirion.samples.AnotherView"
    이부분이 어떻게되는건가요??
    com이라는게 패키지명이시죠??