기본 콘텐츠로 건너뛰기

11월, 2014의 게시물 표시

[android] textview에 이미지 넣기

setCompoundDrawablesWithIntrinsicBounds (int left, int top, int right, int bottom) : 글씨의 왼쪽, 상단, 오른쪽, 아래에 이미지 추가  setCompoundDrawablePadding (int pad) : 이미지와 글씨 사이의 간격 설정 1 2 3 4 TextView txtEvent = (TextView)convertView.findViewById(R.id.cell_event); txtEvent.setCompoundDrawablesWithIntrinsicBounds(R.drawable.event, 0, 0, 0); txtEvent.setCompoundDrawablePadding(10); txtEvent.setText( "이벤트합니다." );

[android] 네트워크 상태가 변경 될 때 마다 실시간 확인 방법. (BroadcastReceiver 사용)

네트워크가 변경되었을 때 실시간으로 앱에서 하고 싶은 동작을 할 수 있다. [AndroidManifest.xml] activity와 동등한 단계에 추가. Colored By Color Scripter ™ 1 2 3 4 5 <receiver android:name  =   "appNetwork" >                 <intent-filter>                         <action android:name= "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED" / >                 < /intent-filter> < /receiver> [appNetwork.java] Colored By Color Scripter ™ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 public   class  appNetwork  extends  BroadcastReceiver  {         private  Activity activity;       ...

[android] fragment 에서 activity 함수 호출하기

[  Fragment ] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 // 3. ListFragment 에서 Activity 에 대한 참조        OnSelectedListener mListener;                 // 1. ListFragment 내에 이벤트 인터페이스를 정의         public   interface  OnSelectedListener  {                 public   void  onDialogSelected( ) ;         } // 3.ListFragment 에서 Activity 에 대한 참조         @Override         public   void  onAttach(Activity activity)   {                 super .onAttach(activity) ;                 try   {         ...