Element : 위치 : 설명
 manifest : root : 애플리케이션 패키지와 안드로이드 네임스페이스 정리
 user-permission : root : 보안 권한 요청
 permission : root : 보안 권한 설정
 instrumentation : root : (다른 패키지) 기능 테스트를 위한 컴포넌트 정의
 application : root : 애플리케이션, Class 이름, Lable, Icon, Theme(manifest 당 한개)등
                            을 정의
 activity : application : activity class 정의
 intent-fiter : activity : Activity 지원하는 Intent 설정.
 action : intent-filter : Intent Actio
 category : intent-filter : Intent category
 data : intent-filter : Intent MIME 타입, UR 스키마, URI 인증, URI 경로 정의
 meta-data : activity : Componentinfo.metaData를 통해 접근 가능한 메타 데이터
 receiver : root : Intent에 응답하는 Intent Receiver 정의. Intent-filter 자식들도 지원
 service : root : BackGround Service 컴포넌트 정의. Intent-filter 자시들도 지원
 provider : root : 다른 애플리케이션에서 접근 가능한 안정적인 데이터 관리를 우한 
                        Content Provider 정의

'안드로이드' 카테고리의 다른 글

명시적 인텐트(Explicit Intent)  (0) 2011.01.17
Intent  (0) 2011.01.17
애니메이션 기능  (0) 2011.01.16
안드로이드 해상도 단위 정리  (0) 2011.01.14
AlarmManager의 Alarm Types  (0) 2011.01.14

안드로이드에서는 애니메이션의 효과를 XML로 줄수가 있습니다.
보통 애니메이션 효과를 주는 XML파일은 res/anim 폴더안에 들어가 있으며,
Layout과 마찬가지로 name/id를 통해 참조할 수 있습니다.
보통 4가지 타입의 애니메이션을 지원을 하고 있는데, 종류는 다음가 같습니다.

 <alpha> : 투명도를 정의, 0.0에서 1.0까지. (0.0은 완전 투명)
 <scale> : 에니메이션의 크기 조절, X와 Y축으로 확장 및 축소.(1.0은 현재 크기를 의미)
 <translate> : 이동 설정, %값 혹은 절대값으로 X, Y 를 사용해서 표시.
 <rotate> : 회전 설정, 기준점(X, Y)을 시작으로 얼마나 회전시킬지 설정.

위의 값들 이외에 애니메이션의 타입에 따라서 아래의 솏ㅇ들도 사용할 수 있습니다.
 duration : 밀리 초 단위의 시간.(효과가 적용되는 시간)
 startoffset : 밀리 초 단위의 오프셋 시작 시간.
 interpolator : 애니메이션이 적용되는 속도를 의미.

xml에서 정의를 해주었다면 자바코드에서는 다음과 같이 사용하여 애니메이션을 적용할 수 있습니다.
 view.startAnimation(AnimationUtils.loadAnimation(this, R.anim.scaler));

'안드로이드' 카테고리의 다른 글

Intent  (0) 2011.01.17
Android Manifest Element  (0) 2011.01.16
안드로이드 해상도 단위 정리  (0) 2011.01.14
AlarmManager의 Alarm Types  (0) 2011.01.14
Alarms  (0) 2011.01.14
안드로이드에서는 Dimension 단위가 종류별로 있습니다.
총 7가지가 있으며, 그 종류는 다음과 같습니다.

 1.px(pixel) : 화면 위의 점
 2.in(inches) : 실제 스크린에 기반한 크기
 3.mm(millimeters) : 실제 스크린에 기반한 크기
 4.pt(points) : 인치의 1/72 사이즈
 5.dp(density-independent pixels, 밀도에 독립적인 화소): 화면의 밀도에 기초한 추상 
         단위, 인치당 160개의 점이 있는 디스플레이에서 1dp는 1px과 같다.
 6.dip : 구글 예제에서 자주 쓰이는 dp의 동의어
 7.sp(scale-independent pixels, 스케일에 독립적인 화소) : dp와 유사하지만 사용자의
         글꼴 크기 설정에 따라 확대/축소 될수 있다.

위와 같이 7가지의 단위가 존재하며, 각각의 단위를 소스상에서 다른 단위로 변환을 할 수 있습니다. 변환 방법은 TypedValue api를 사용하는 방법이 있습니다.
계산 방법은 다음과 같습니다.

 private static final float GESTURE_THRESHOLD_DIP = 16.0f; //상수 정의
 mGestureThreshold = TypedValue.applyDimension(
                                                       TypedValue.COMPLEX_UNIT_DIP,
                                                       GESTURE_THRESHOLD_DIP,
                                                       getResources().getDisplayMetrics());

applyDimension함수의 첫번째 인자는 TypedValue.COMPLEX_UNIT_DIP가 뜻하는 
값으로 바꾸겠다는 것입니다. 아래의 표를 보시면 아시겟지만, 
COMPLEX_UNIT_DIP 는 DIP값을 px로 값을 바꿔 주는 역할을 하고 있습니다.

Constants
int COMPLEX_MANTISSA_MASK Complex data: mask to extract mantissa information (after shifting byCOMPLEX_MANTISSA_SHIFT).
int COMPLEX_MANTISSA_SHIFT Complex data: bit location of mantissa information.
int COMPLEX_RADIX_0p23 Complex data: the mantissa magnitude is 0 bits -- i.e, 0x0.nnnnnn
int COMPLEX_RADIX_16p7 Complex data: the mantissa magnitude is 16 bits -- i.e, 0xnnnn.nn
int COMPLEX_RADIX_23p0 Complex data: the mantissa is an integral number -- i.e., 0xnnnnnn.0
int COMPLEX_RADIX_8p15 Complex data: the mantissa magnitude is 8 bits -- i.e, 0xnn.nnnn
int COMPLEX_RADIX_MASK Complex data: mask to extract radix information (after shifting byCOMPLEX_RADIX_SHIFT).
int COMPLEX_RADIX_SHIFT Complex data: where the radix information is, telling where the decimal place appears in the mantissa.
int COMPLEX_UNIT_DIP TYPE_DIMENSION complex unit: Value is Device Independent Pixels.
int COMPLEX_UNIT_FRACTION TYPE_FRACTION complex unit: A basic fraction of the overall size.
int COMPLEX_UNIT_FRACTION_PARENT TYPE_FRACTION complex unit: A fraction of the parent size.
int COMPLEX_UNIT_IN TYPE_DIMENSION complex unit: Value is in inches.
int COMPLEX_UNIT_MASK Complex data: mask to extract unit information (after shifting byCOMPLEX_UNIT_SHIFT).
int COMPLEX_UNIT_MM TYPE_DIMENSION complex unit: Value is in millimeters.
int COMPLEX_UNIT_PT TYPE_DIMENSION complex unit: Value is in points.
int COMPLEX_UNIT_PX TYPE_DIMENSION complex unit: Value is raw pixels.
int COMPLEX_UNIT_SHIFT Complex data: bit location of unit information.
int COMPLEX_UNIT_SP TYPE_DIMENSION complex unit: Value is a scaled pixel.
int DENSITY_DEFAULT If density is equal to this value, then the density should be treated as the system's default density value: DENSITY_DEFAULT.
int DENSITY_NONE If density is equal to this value, then there is no density associated with the resource and it should not be scaled.
int TYPE_ATTRIBUTE The data field holds an attribute resource identifier (referencing an attribute in the current theme style, not a resource entry).
int TYPE_DIMENSION The data field holds a complex number encoding a dimension value.
int TYPE_FIRST_COLOR_INT Identifies the start of integer values that were specified as color constants (starting with '#').
int TYPE_FIRST_INT Identifies the start of plain integer values.
int TYPE_FLOAT The data field holds an IEEE 754 floating point number.
int TYPE_FRACTION The data field holds a complex number encoding a fraction of a container.
int TYPE_INT_BOOLEAN The data field holds 0 or 1 that was originally specified as "false" or "true".
int TYPE_INT_COLOR_ARGB4 The data field holds a color that was originally specified as #argb.
int TYPE_INT_COLOR_ARGB8 The data field holds a color that was originally specified as #aarrggbb.
int TYPE_INT_COLOR_RGB4 The data field holds a color that was originally specified as #rgb.
int TYPE_INT_COLOR_RGB8 The data field holds a color that was originally specified as #rrggbb.
int TYPE_INT_DEC The data field holds a number that was originally specified in decimal.
int TYPE_INT_HEX The data field holds a number that was originally specified in hexadecimal (0xn).
int TYPE_LAST_COLOR_INT Identifies the end of integer values that were specified as color constants.
int TYPE_LAST_INT Identifies the end of plain integer values.
int TYPE_NULL The value contains no data.
int TYPE_REFERENCE The data field holds a resource identifier.
int TYPE_STRING The string field holds string data.

'안드로이드' 카테고리의 다른 글

Android Manifest Element  (0) 2011.01.16
애니메이션 기능  (0) 2011.01.16
AlarmManager의 Alarm Types  (0) 2011.01.14
Alarms  (0) 2011.01.14
자주 이용하는 블로그  (0) 2011.01.13
Alarm Type들을 지정함으로써, 알람 시간의 Timer를 지정할 수 있습니다.
Alarm Type은 다음과 같습니다.

Alarm Type
 - ELAPSED_REALTIME
     : SystemClock.elapsedRealtime 메서드의 알람 시간(Sleep Mode Time을 포함한 부팅
       이후의 시간)
   ELAPSED_REALTIME_WAKEUP
     : SystemClock.elapsedRealtime 메서드의 알람 시간(Sleep Mode Time을 포함한 부팅
       이후의 시간), 기기가 Sleep Mode일시, 알림이 울리면 기기를 작동.
   RTC
     : System.currentTimeMillis 메서드의 알람시간.(밀리세컨 단위로 시간을 설정.)
   RTC_WAKEUP
     : System.currentTimeMillis 메서드의 알람시간.(밀리세컨 단위로 시간을 설정.)
       , 기기가 Sleep Mode일시, 알림이 울리면 기기를 작동.

보통 알람의 시간을 지정할 때는 다음과 같이 사용합니다.
 Calendar calendar = Calendar.getInstance();
 calendar.setTimeInMillis(System.currentTimeMillis());
 calendar.add(Calendar.SECOND, 30); 
 
 AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
 am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeinMillis(), intent);

'안드로이드' 카테고리의 다른 글

애니메이션 기능  (0) 2011.01.16
안드로이드 해상도 단위 정리  (0) 2011.01.14
Alarms  (0) 2011.01.14
자주 이용하는 블로그  (0) 2011.01.13
안드로이드 APK 다운로드 홈페이지  (0) 2011.01.13
알람(Alarms)이란?
 - Application의 시작, Software Update 체크, 종료와 같이 지정된 일들을 사용자에게 
   알려줍니다.
   알람 기능은 알람을 인텐트와 함께 등록시켜줌으로써 동작되는데, 알람은 정해진 시간이
   되면, 인텐트를 브로드 케스팅 합니다.
   그리고 Sleep Mode인 경우에도 지정된 시간이 되면 지정된 Application을 자동으로 
   수행시킵니다.
   알람은 AlarmManager를 이용하여, 사용자가 지정된 시간에, 원하는 동작을 하도록 
   하는데, AlarmManager의 Method를 다음과 같이 정리하였습니다.

AlarmManager 
   void cancel(PendingIntent intent) : 일치하는 Intent Alarm 제거
   void set(int type, long triggerAtTime, PendingIntent operation) : 알람 설정.
   void setRepeating(int type, long triggerAtTime, long interval, PendingIntent operation)      : 반복 알람 설정.
   void setTimeZone(String TimeZone) : 알람을 위한 시간대 설정. 

보통 Context.getSystemService(contextALARM_SERVICE) 메서드를 이용하여, 알람 매니저의 인스턴스를 생성합니다.

예제소스
Manifast.xml
 <application android:icon="@drawable/clock">
        <activity android:name=".GenerateAlarm" android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <receiver android:name=".AlarmReceiver" android:process=":remote" />
    </application>

AlarmReceiver.java

 public class AlarmReceiver extends BroadcastReceiver {

    public void onReceiveIntent(Context context, Intent intent) {
        Toast.makeText(context, R.string.app_name, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onReceive(Context context, Intent intent) {

    }
}


GenerateAlarm.java

 public class GenerateAlarm extends Activity {

    Toast mToast;

    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);
        Button button = (Button) findViewById(R.id.set_alarm_button);
        button.setOnClickListener(this.mOneShotListener);
    }

    private OnClickListener mOneShotListener = new OnClickListener() {

        public void onClick(View v) {

            Intent intent = new Intent(GenerateAlarm.this, AlarmReceiver.class);

            PendingIntent appIntent = PendingIntent.getBroadcast(GenerateAlarm.this, 0, intent, 0);

            Calendar calendar = Calendar.getInstance();
            calendar.setTimeInMillis(System.currentTimeMillis());
            calendar.add(Calendar.SECOND, 30);

            AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
            am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), appIntent);

            if (GenerateAlarm.this.mToast != null) {
                GenerateAlarm.this.mToast.cancel();
            }
            GenerateAlarm.this.mToast = Toast.makeText(GenerateAlarm.this, R.string.alarm_message, Toast.LENGTH_LONG);
            GenerateAlarm.this.mToast.show();
        }
    };

}


'안드로이드' 카테고리의 다른 글

AlarmManager의 Alarm Types  (0) 2011.01.14
Alarms  (0) 2011.01.14
안드로이드 APK 다운로드 홈페이지  (0) 2011.01.13
윈도우 환경에서 안드로이드 풀소스 받기  (0) 2011.01.12
View의 계층 구조  (0) 2011.01.10

'안드로이드' 카테고리의 다른 글

Alarms  (0) 2011.01.14
자주 이용하는 블로그  (0) 2011.01.13
윈도우 환경에서 안드로이드 풀소스 받기  (0) 2011.01.12
View의 계층 구조  (0) 2011.01.10
Activity LifeCycle  (0) 2011.01.10

1. GIT프로그램을 다운받아서 설치합니다.
    - http://code.google.com/p/msysgit/ 에서 받으시면 됩니다.
      파일을 첨부하였으니 받으셔서 사용하셔도 됩니다.
2. GIT프로그램을 설치 하였으면, GIT프로그램을 실행하여 소스를 저장할 곳의 폴더를 생성 
    합니다.   

 cd /c      -> [/드라이브 명 (여기서는 C드라이브를 기준으로 하였습니다.)]
 mkdir android_source     -> [mkdir 다음에는 생성할 폴더 이름입니다.]
 cd android_source         -> [생성한 폴더로 이동입니다.]

    폴더를 생성하였다면, 윈도우에서 autogit.sh라는 파일을 다운로드 받을 폴더에 저장합니
    다.
3. GIT 창에서 autogit.sh라는 명령어를 실행하면 안드로이드 풀소스를 다운받을 수
   있습니다.
 sh autogit.sh  -> [http://android.git.kernel.org/ 에서 다운로드 명령]

   보통 다운로드하는데 시간이 오래 걸리므로 이 점을 가만하셔야 합니다.
   저는 보통 5~6시간이상 걸린것같네요. ^^;


만약 모듈별로 받고 싶다면 http://android.git.kernel.org/ 에 접속한 후 원하는 모듈을 받아서 알집 같은 압축프로그램으로 풀면 됩니다.

         

'안드로이드' 카테고리의 다른 글

자주 이용하는 블로그  (0) 2011.01.13
안드로이드 APK 다운로드 홈페이지  (0) 2011.01.13
View의 계층 구조  (0) 2011.01.10
Activity LifeCycle  (0) 2011.01.10
Activity Stack  (0) 2011.01.10
위의 그림과 같이 여러 뷰들이 모여서 위젯이 구성이되고 나중에는 Application이 구성이 되는 것입니다.

위의 View들은 기본 Class Method에 접근이 가능하며, 해당 View들의 Method를 다음과 같이 간단하게 정리하여 보았습니다.

1. View
setBackgroundColor(int color) : 백그라운드 색상 설정.
setBackgroundDrawable(Drawable d) : 백그라운드 이미지 설정.
setMinimumHeight(int minHeight) : 최소 높이 설정.
setMinimumWidth(int minWight) : 최소 넓이 설정.
setPadding(int left, int right, int top, int bottom) : 여백 사이즈 설정.
setClickable(boolean c) : 엘리먼트의 클릭 가능 여부 체크.
setFocusable(boolean f) : 엘리먼트의 포커스 가능 여부 체크.
setOnClickListener(OnClickListener l) : 클릭 이벤트 발생 여부 체크 설정.
setOnFocusChangeListener(OnFocusChangeListener l) :
                                                               포커스 이벤트 발생 여부 체크 설정.
setLayoutPalams(ViewGroup.LayoutParams l) : 레이아웃 파라미터 설정.

2. TextView
setGravity(int gravity) : 중력(위, 아래, 오른쪽 등) 셋팅
setHeight(int height) : 높이 셋팅
setWidth(int width) : 넓이 셋팅
setTypeFace(TypeFace face) : 서체 셋팅
setText(CharSequence text) : 텍스트 셋팅

3. ListView
setEmptyView(View EmptyView) : List Item이 없을경우 사용할 View 설정
setItemCanFocus(boolean bFocus) : 각 항목에 Focus를 줄것인지 말것인지를
                                                     설정.
setChoiceMode(int choiceMode) : 선택할 수 있는 항목이 하나인지 다수인지를
                                                 설정.
setAdapter(ListAdapter adapter) : List에 넣을 항목들을 설정.
addFooterView(View v) : 항상 List의 마지막에만 존재하는 항목 추가.
addHeaderView(View v) : 항상 List의 맨 위에만 존재하는 항목 추가.


'안드로이드' 카테고리의 다른 글

안드로이드 APK 다운로드 홈페이지  (0) 2011.01.13
윈도우 환경에서 안드로이드 풀소스 받기  (0) 2011.01.12
Activity LifeCycle  (0) 2011.01.10
Activity Stack  (0) 2011.01.10
안드로이드 우선순위  (0) 2011.01.10
안드로이드쪽 일을 하면서 가장 중요하다고 생각되는 부분은 Activity Lifecyrcle이라고 생각이 듭니다. 이 파트를 이해를 해야지만이 Activity를 구현하는데 있어서 가장 효율적으로 구현을 할수 있다고 생각하기 때문입니다.

안드로이드는 자신의 프로세스 수명을 직접제어 하지 않습니다. 이를 제어하는 것은 안드로이드 런타임이며, 이는 각각의 프로세스와 Activity들을 관리를 합니다.

여기서는 Activity가 생성되고 종료되는 과정을 정리하였습니다.

안드로이드가 제공하는 각 LifeCycle method들은 분명한 목적을 가지고 있으며,
Foreground, Visible, Entire LifeCycle Mode에서 수행되고 있습니다.
그림으로 정리를 하자면 다음과 같습니다.


 
Foreground phase : 수행중인 Activity를 뜻하며, 다른 모든 것들 보다 최상위에 위치합니다.
                             이는 사용자와 Activity들간의 상호작용을 하는 과정을 뜻합니다.
Visible phase : 수행중인 Activity는 화면에는 나타나지만, 사용자와의 상호작용이 발생되지
                      않습니다.
Entire lifecycle : 화면에 나타나지 않은 상태에서 Activity가 만들어 지기 전에 호출되거나 
                       종료에 앞서 Activity가 종료되는 단계에서 호출되는 Mehtod


 
public class Activity extends ApplicationContext {
     
protected void onCreate(Bundle savedInstanceState);

     
protected void onStart();
     
     
protected void onRestart();

     
protected void onResume();

     
protected void onPause();

     
protected void onStop();

     
protected void onDestroy();
 
}

onCreate() : Activity가 새성될 때 호출. 이전에 저장된 Bundle형태의 데이터에 접근 가능.
onRestart() : Activity가 재시작 되는 과정에서 호출.
                   새로 시작하는 것이 아닌 멈추었던 작업을 재개하는 것.
onStart() : Activity가 화면에 보이는 단계.
onResume() : Activity를 사용자가 사용할 때 호출.(Activity가 시작하거나 재시작시 호출.)
onPause() : Activity가 중단되거나 CPU와 다른 자원들을 요청할 때 호출.
onStop() : Activity 를 중단시키고 화면에서 보이지 않는 상태로 바꾸기 위해 호출.
onDestroy() : Activity가 시스템 메모리에서 완전히 제거될 때 호출.
                   onFinish() Method가 직접 호출 되거나 시스템이 Resource들을 확보하기 
                   위해 Activity를 중단할 때 호출.

'안드로이드' 카테고리의 다른 글

윈도우 환경에서 안드로이드 풀소스 받기  (0) 2011.01.12
View의 계층 구조  (0) 2011.01.10
Activity Stack  (0) 2011.01.10
안드로이드 우선순위  (0) 2011.01.10
어플리케이션의 구성요소  (0) 2011.01.09

+ Recent posts