'old'에 해당되는 글 427건

  1. 2010.03.23 APP_LauncherShortcuts
  2. 2010.03.23 APP_Intents
  3. 2010.03.22 APP_Dialog_AlertDialogSamples
  4. 2010.03.22 APP_Alarm_AlarmService
  5. 2010.03.18 Definitions
  6. 2010.03.18 외부 키
  7. 2010.03.18 열 구성 변경
  8. 2010.03.17 용어
  9. 2010.03.17 TRANSACTION
  10. 2010.03.17 INDEX
  11. 2010.03.17 한정 술어
  12. 2010.03.17 집합 연산자
  13. 2010.03.17 VIEW
  14. 2010.03.17 JOIN
  15. 2010.03.16 APP_Alarm_AlarmController
  16. 2010.03.16 APP_Activity_Wallpaper
  17. 2010.03.16 APP_Activity_TranslucentBlurActivity
  18. 2010.03.16 APP_Activity_TranslucentActivity
  19. 2010.03.16 APP_Activity_SetWallpaper
  20. 2010.03.16 APP_Activity_ReorderActivities
  21. 2010.03.16 APP_Activity_Redirection
  22. 2010.03.16 APP_Activity_ReceiveResult
  23. 2010.03.16 Sub Query
  24. 2010.03.16 DELETE
  25. 2010.03.16 UPDATE
  26. 2010.03.16 INSERT
  27. 2010.03.16 Iterator(구 Enumeration), ListIterator
  28. 2010.03.15 APP_Activity_Persistent State
  29. 2010.03.15 APP_Activity_Hello World
  30. 2010.03.15 APP_Activity_Forwarding

APP_LauncherShortcuts

old/API_Demo 2010. 3. 23. 15:59

    private static final String EXTRA_KEY = "com.example.android.apis.app.LauncherShortcuts";

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        final Intent intent = getIntent();
       final String action = intent.getAction();

        if (Intent.ACTION_CREATE_SHORTCUT.equals(action)) {
            setupShortcut();
            finish();
            return;
        }

        setContentView(R.layout.launcher_shortcuts);

        TextView intentInfo = (TextView) findViewById(R.id.txt_shortcut_intent);
        String info = intent.toString();
        String extra = intent.getStringExtra(EXTRA_KEY);
        if (extra != null) {
            info = info + " " + extra;
        }
        intentInfo.setText(info);
    }

    private void setupShortcut() {

        Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
        shortcutIntent.setClassName(this, this.getClass().getName());
        shortcutIntent.putExtra(EXTRA_KEY, "ApiDemos Provided This Shortcut");

        Intent intent = new Intent();
        intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
        intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.shortcut_name));
        Parcelable iconResource = Intent.ShortcutIconResource.fromContext(
                this,  R.drawable.app_sample_code);
        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);

        setResult(RESULT_OK, intent);
    }
}

'old > API_Demo' 카테고리의 다른 글

APP_Notification_IncomingMessageView  (0) 2010.03.23
APP_Menu_InflateFromXML  (0) 2010.03.23
APP_Intents  (0) 2010.03.23
APP_Dialog_AlertDialogSamples  (0) 2010.03.22
APP_Alarm_AlarmService  (0) 2010.03.22
Posted by jazzlife
,

APP_Intents

old/API_Demo 2010. 3. 23. 13:16
[Intents.java]

    private OnClickListener mGetMusicListener = new OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
          intent.setType("audio/*");
          startActivity(Intent.createChooser(intent, "Select music"));
        }
    };


'old > API_Demo' 카테고리의 다른 글

APP_Menu_InflateFromXML  (0) 2010.03.23
APP_LauncherShortcuts  (0) 2010.03.23
APP_Dialog_AlertDialogSamples  (0) 2010.03.22
APP_Alarm_AlarmService  (0) 2010.03.22
APP_Alarm_AlarmController  (0) 2010.03.16
Posted by jazzlife
,

[AlertDialogSamples.java]

 @Override
    protected Dialog onCreateDialog(int id) {
        switch (id) {

        case DIALOG_YES_NO_MESSAGE:
            return new AlertDialog.Builder(AlertDialogSamples.this)
                .setIcon(R.drawable.alert_dialog_icon)
                .setTitle(R.string.alert_dialog_two_buttons_title)
                .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                    }
                })
                .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {

                        /* User clicked Cancel so do some stuff */
                    }
                })
                .create().show();

        case DIALOG_YES_NO_LONG_MESSAGE:
            return new AlertDialog.Builder(AlertDialogSamples.this)
                .setIcon(R.drawable.alert_dialog_icon)
                .setTitle(R.string.alert_dialog_two_buttons_msg)
                .setMessage(R.string.alert_dialog_two_buttons2_msg)
                .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                    }
                })
                .setNeutralButton(R.string.alert_dialog_something, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                    }
                })
                .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                    }
                })
                .create().show();

        case DIALOG_LIST:
            return new AlertDialog.Builder(AlertDialogSamples.this)
                .setTitle(R.string.select_dialog)
                .setItems(R.array.select_dialog_items, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {

                        /* User clicked so do some stuff */
                        String[] items = getResources().getStringArray(R.array.select_dialog_items);
                        new AlertDialog.Builder(AlertDialogSamples.this)
                                .setMessage("You selected: " + which + " , " + items[which])
                                .show();
                    }
                })
                .create().show();

        case DIALOG_PROGRESS:
            mProgressDialog = new ProgressDialog(AlertDialogSamples.this);
            mProgressDialog.setIcon(R.drawable.alert_dialog_icon);
            mProgressDialog.setTitle(R.string.select_dialog);
            mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            mProgressDialog.setMax(MAX_PROGRESS);
            mProgressDialog.setButton(getText(R.string.alert_dialog_hide), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                }
            });
            mProgressDialog.setButton2(getText(R.string.alert_dialog_cancel), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                }
            });
            return mProgressDialog;

        case DIALOG_SINGLE_CHOICE:
            return new AlertDialog.Builder(AlertDialogSamples.this)
                .setIcon(R.drawable.alert_dialog_icon)
                .setTitle(R.string.alert_dialog_single_choice)
                .setSingleChoiceItems(R.array.select_dialog_items2, 0, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                    }
                })
                .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                    }
                })
                .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                    }
                })
               .create().show();

        case DIALOG_MULTIPLE_CHOICE:
            return new AlertDialog.Builder(AlertDialogSamples.this)
                .setIcon(R.drawable.ic_popup_reminder)
                .setTitle(R.string.alert_dialog_multi_choice)
                .setMultiChoiceItems(R.array.select_dialog_items3,
                        new boolean[]{false, true, false, true, false, false, false},
                        new DialogInterface.OnMultiChoiceClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton,
                                    boolean isChecked) {
                            }
                        })
                .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                    }
                })
                .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                    }
                })
               .create().show();

        case DIALOG_TEXT_ENTRY:

            LayoutInflater factory = LayoutInflater.from(this);
            final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null);
            return new AlertDialog.Builder(AlertDialogSamples.this)
                .setIcon(R.drawable.alert_dialog_icon)
                .setTitle(R.string.alert_dialog_text_entry)
                .setView(textEntryView)
                .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                    }
                })
                .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                    }
                })
                .create().show();
        }
        return null;
    }


  mProgressHandler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                super.handleMessage(msg);
                if (mProgress >= MAX_PROGRESS) {
                    mProgressDialog.dismiss();
                } else {
                    mProgress++;
                    mProgressDialog.incrementProgressBy(1);
                    mProgressHandler.sendEmptyMessageDelayed(0, 100);
                }
            }
        };
    }

'old > API_Demo' 카테고리의 다른 글

APP_LauncherShortcuts  (0) 2010.03.23
APP_Intents  (0) 2010.03.23
APP_Alarm_AlarmService  (0) 2010.03.22
APP_Alarm_AlarmController  (0) 2010.03.16
APP_Activity_Wallpaper  (0) 2010.03.16
Posted by jazzlife
,

[Alarm Service.java]

 private OnClickListener mStartAlarmListener = new OnClickListener() {
        public void onClick(View v) {

            long firstTime = SystemClock.elapsedRealtime();

            AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
            am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
                            firstTime, 30*1000, mAlarmSender);

            Toast.makeText(AlarmService.this, R.string.repeating_scheduled,
                    Toast.LENGTH_LONG).show();
        }
 

  };

    private OnClickListener mStopAlarmListener = new OnClickListener() {
        public void onClick(View v) {
 
            AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
            am.cancel(mAlarmSender);

               Toast.makeText(AlarmService.this, R.string.repeating_unscheduled,
                    Toast.LENGTH_LONG).show();

        }
    };

}



[Manifest.xml]

<service android:name=".app.AlarmService_Service" android:process=":remote" />

        <activity android:name=".app.AlarmService" android:label="@string/activity_alarm_service">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.SAMPLE_CODE" />
            </intent-filter>
        </activity>


 

'old > API_Demo' 카테고리의 다른 글

APP_Intents  (0) 2010.03.23
APP_Dialog_AlertDialogSamples  (0) 2010.03.22
APP_Alarm_AlarmController  (0) 2010.03.16
APP_Activity_Wallpaper  (0) 2010.03.16
APP_Activity_TranslucentBlurActivity  (0) 2010.03.16
Posted by jazzlife
,

Definitions

old/sms&mms 2010. 3. 18. 15:53

For the purposes of the present document, the following terms and definitions apply:

NOTE 1:   The term "mobile station" (MS) in the present document is synonymous with the term "user equipment" (UE) in UMTS terminology as defined in 3GPP TR 21.905 [29].

active MS: switched‑on mobile station with a SIM/UICC see 3GPP TS 31.101 [31] module attached

alert‑SC: service element provided by a GSM/UMTS PLMN to inform an SC which has previously initiated unsuccessful short message delivery attempt(s) to a specific MS, that the MS is now recognized by the PLMN to have recovered operation

status report: SC informing the originating MS of the outcome of a short message submitted to an SME

Gateway MSC For Short Message Service (SMS‑GMSC): function of an MSC capable of receiving a short message from an SC, interrogating an HLR for routing information and SMS info, and delivering the short message to the VMSC or the SGSN of the recipient MS

Interworking MSC For Short Message Service (SMS‑IWMSC): function of an MSC capable of receiving a short message from within the PLMN and submitting it to the recipient SC

IP-Short-Message-Gateway (IP-SM-GW): function responsible for protocol interworking between the IP-based UE and the SC

Messages‑Waiting (MW): ervice element that makes a PLMN store information (Messages‑Waiting‑Indication), listing those SCs that have made unsuccessful short message delivery attempts to MSs in that PLMN

Messages‑Waiting‑Indication (MWI): data to be stored in the HLR and VLR with which an MS is associated, indicating that there is one or more messages waiting in a set of SCs to be delivered to the MS (due to unsuccessful delivery attempt(s))

Messages‑Waiting‑Data (MWD): part of the MWI to be stored in the HLR. MWD consists of an address list of the SCs which have messages waiting to be delivered to the MS

Mobile-services Switching Centre (MSC): exchange which performs switching functions for mobile stations located in a geographical area designated as the MSC area

Mobile‑Station‑Memory‑Capacity‑Exceeded‑Flag (MCEF): part of the MWI to be stored in the HLR

NOTE 2:   MCEF is a Boolean parameter indicating if the address list of MWD contains one or more entries because an attempt to deliver a short message to an MS has failed with a cause of MS Memory Capacity Exceeded

Mobile‑Station‑Not‑Reachable‑Flag (MNRF): part of the MWI to be stored in the VLR and the HLR

NOTE 3:   MNRF is a Boolean parameter indicating if the address list of MWD contains one or more entries because an attempt to deliver a short message to an MS has failed with a cause of Absent Subscriber.

Mobile‑station‑Not-Reachable-for-GPRS (MNRG): part of the MWI to be stored in the SGSN and the HLR

NOTE 4:   MNRG is a Boolean parameter indicating if the address list of MWD contains one or more entries because an attempt to deliver a short message to an MS has failed with a cause of Absent Subscriber.

Mobile‑Station‑Not‑Reachable-via-the-MSC-Reason (MNRR-MSC): part of the MWI in the HLR which stores the reason for an MS being absent when an attempt to deliver a short message to an MS fails at the MSC with a cause of Absent Subscriber

Mobile‑Station‑Not‑Reachable-via-the-SGSN-Reason (MNRR-SGSN): part of the MWI in the HLR which stores the reason for an MS being absent when an attempt to deliver a short message to an MS fails at the SGSN with a cause of Absent Subscriber

More‑Messages‑To‑Send (MMS): information element offering an MS receiving a short message from an SC the information whether there are still more messages waiting to be sent from that SC to the MS

NOTE 5:   The TP‑MMS element (conveyed in the Transfer layer) is copied into the RP‑MMS element (conveyed in the Relay layer). It is possible with Phase 2 and later versions of MAP (3GPP TS 29.002 [15]) for the RP‑MMS element to keep an SM transaction open between the SMS-GMSC and the MS in the case where there are more‑messages‑to‑send. Earlier versions of MAP support the transport of the TP‑MMS element.

priority: service element enabling the SC or SME to request a short message delivery attempt to an MS irrespective of whether or not the MS has been identified as temporarily absent

protocol‑identifier: information element by which the originator of a short message (either an SC or an MS) may refer to a higher layer protocol

receiving MS: the mobile station to which an MT SM is destined.

reply path procedure: mechanism which allows an SME to request that an SC should be permitted to handle a reply sent in response to a message previously sent from that SME to another SME

NOTE 6:   This may happen even though the SC may be unknown to the SME which received the initial message.

report: response from either the network or the recipient upon a short message being sent from either an SC or an MS

NOTE 7:   A report may be a delivery report, which confirms the delivery of the short message to the recipient, or it may be a failure report, which informs the originator that the short message was never delivered and the reason why.

      When issued by the Service Centre, the delivery report confirms the reception of the Short Message by the SC, and not the delivery of the Short Message to the SME.

      When issued by the Mobile Station, the delivery report confirms the reception of the Short Message by the Mobile Station, and not the delivery of the Short Message to the user.

replace short message type: range of values in the Protocol Identifier which allows an indication to be sent with a short message (MT or MO) that the short message is of a particular type allowing the receiving MS or the SC to replace an existing message of the same type held in the SC, the ME or on the SIM/UICC, provided it comes:

     in MT cases:                 from the same SC and originating address;

     in MO cases:                 from the same MS.

sending MS: the mobile station from which an MO SM is sourced.

Service Centre (SC): function responsible for the relaying and store‑and‑forwarding of a short message between an SME and an MS

NOTE 8:   The SC is not a part of the GSM/UMTS PLMN, however MSC and SC may be integrated.

Serving GPRS Support Node (SGSN): exchange which performs packet switching functions for mobile stations located in a geographical area designated as the SGSN area

short message: information that may be conveyed by means of the Short Message Service

NOTE 9:   As described in the present document.

Short Message Entity (SME): entity which may send or receive Short Messages

NOTE 10: The SME may be located in a fixed network, an MS, or an SC.

SMS‑STATUS‑REPORT: short message transfer protocol data unit informing the receiving MS of the status of a mobile originated short message previously submitted by the MS, i.e. whether the SC was able to forward the message or not, or whether the message was stored in the SC for later delivery

SMS‑COMMAND: short message transfer protocol data unit which enables an MS to invoke an operation at the SC

NOTE 11: An MS may then, for example, delete a short message, cancel a TP-Status-Report-Request, enquire about the status of a short message or request another function to be performed by the SC.

NOTE 12: The type of operation is indicated by the TP‑Command‑Type and the particular SM to operate on is indicated by the TP‑Message‑Number and the TP‑Destination‑Address. Receipt of an SMS‑COMMAND is confirmed by an RP‑ACK or RP‑ERROR. In the case of certain SMS‑COMMANDs, an SMS‑STATUS‑REPORT may be sent, where the outcome of the SMS‑COMMAND is passed in its TP‑Status field.

SMS‑DELIVER: short message transfer protocol data unit containing user data (the short message), being sent from an SC to an MS

SMS‑SUBMIT: short message transfer protocol data unit containing user data (the short message), being sent from an MS to an SC

Service‑Centre‑Time‑Stamp (SCTS): information element offering the recipient of a short message the information of when the message arrived at the SM‑TL entity of the SC

NOTE 13: The time of arrival comprises the year, month, day, hour, minute, second and time zone.

UE‑Not-Reachable-for-IP (UNRI): part of the MWI to be stored in the IP-SM-GW and the HSS/HLR

NOTE 14: UNRI is a Boolean parameter indicating if the address list of MWD contains one or more entries because an attempt to deliver a short message to an UE has failed with a cause of Absent Subscriber.

UE‑Not‑Reachable-Reason (UNRR): part of the MWI in the HSS/HLR which stores the reason for an UE being absent when an attempt to deliver a short message to an UE fails at the IP-SM-GW.

Validity‑Period (VP): information element enabling the originator MS to indicate the time period during which the originator considers the short message to be valid.

Visitor Location Register (VLR) is a database - part of the GSM mobile phone system - which stores information about all the mobiles that are currently under the jurisdiction of the MSC (Mobile Switching Center) which it serves. Of all the information it stores about each MS (Mobile Station), the most important is the current LAI (Location Area Identity). LAI identifies under which BSC (Base Station Controller) the MS is currently present. This information is vital in the call setup process.

Whenever an MSC detects a new MS in its network, in addition to creating a new record in the VLR, it also updates the HLR of the mobile subscriber, apprising it of the new location of that MS.


3rd Generation Partnership Project (3GPP)
Technical Specification (TS)
Short Message Service (SMS)
Public Land Mobile Network (PLMN)
Operator Determined Barring (ODB)
Cell Broadcast Service (CBS)
Service Centre(s) (SC)
Mobile‑services Switching Centre(s) (MSC)
Point-to-Point (PP)
Short Message Service (SMS)
Data Terminal Equipment ‑ Data Circuit terminating Equipment (DTE ‑ DCE)
Mobile Application Part (MAP)
Subscriber Identity Module ‑ Mobile Equipment (SIM‑ ME)
Universal Multiple‑Octet Coded Character Set (USC)
Personalisation of Mobile Equipment (ME)
General Packet Radio Service (GPRS)
Ir Mobile Communications (IrMC)
Internet Mail Consortium (IMC)
Session Initiation Protocol (SIP)
mobile station" (MS)

'old > sms&mms' 카테고리의 다른 글

SMS framework 소스 참고  (0) 2010.05.10
framework_source 참고  (0) 2010.05.10
telephony framework architecture  (0) 2010.04.26
3GPP Technical Specification Documents Download Site  (0) 2010.04.03
Network switching subsystem  (0) 2010.03.24
Posted by jazzlife
,

외부 키

old/SQL 2010. 3. 18. 14:17
; 서로 다른 테이블의 열끼리 동기화

1) 정의하기


(외부키가 될)열이름 데이터 형 REFERENCES 부모 테이블명(부모 열이름)

2) 테이블 제약 조건

FOREIGN KEY (외부키 열이름) REFERENCES 부모 테이블명(부모 열이름)


3) 나중에 설정하기

(SQL server, MySQL)
ALTER TABLE
자식 테이블 명 ADD FOREIGN KEY (외부 열이름)
                                                  REFERENCES 부모 테이블명(부모 열이름);

(PostgreSQL)
ALTER TABLE
자식 테이블명 ADD FOREIGN KEY (외부 열이름)
                                             REFERENCES 부모 테이블명 부모 열이름;

'old > SQL' 카테고리의 다른 글

Command Line Shell For SQLite  (0) 2010.07.06
열 구성 변경  (0) 2010.03.18
용어  (0) 2010.03.17
TRANSACTION  (0) 2010.03.17
INDEX  (0) 2010.03.17
Posted by jazzlife
,

열 구성 변경

old/SQL 2010. 3. 18. 11:48

1) 열 추가

ALTER TABLE 테이블명 ADD 열이름 데이터형;

(Oracle)
ALTER TABLE 테이블명 ADD (열이름 데이터형);

(PostgreSQL)
ALTER TABLE 테이블명 ADD COLUMN 열이름 데이터형;

* 기본값 갖기
ALTER TABLE 테이블명 ADD 열이름 데이터형 DEFAULT 기본값;


2) 열 삭제

ALTER TABLE 테이블명 DROP COLUMN 열이름;

(Oracle)
ALTER TABLE
테이블명 DROP (열이름);

(PostgreSQL)
ALTER TABLE
테이블명 DROP 열이름;


3) 제약 조건 추가 (PRIMARY KEY, UNIQUE, CHECK 제약 조건)

ALTER TABLE 테이블명 ADD PRIMARY KEY(열이름);

ALTER TABLE 테이블명 ALTER COLUMN 열이름 데이터형 NOT NULL;

(Oracle)
ALTER TABLE
테이블명 MODIFY (item NOT NULL);

(PostgreSQL)
ALTER TABLE
테이블명 ALTER COLUMN 열이름 SET NOT NULL;


4) 테이블 이름 변경

EXEC sp_rename 원래 테이블명, 새 테이블 명

(Oracle)
RENAME
  원래 테이블명TO 새  테이블명;

(MySQL, PostgreSQL)
ALTER TABLE
 원래 테이블명 RENAME TO 새 테이블명;


5) 열 이름 변경

EXEC sp_rename 테이블명.[원래 열이름]', 새 열이름

(MySQL)
ALTER TABLE
 테이블명 HANGE code b_no INTEGER;

(PostgreSQL)
ALTER TABLE
 테이블명 RENAME COLUMN 원래 열이름 TO 새 열이름;


6) 설정 추가

(Oracle)
ALTER TABLE
 테이블명 MODIFY (열이름 DEFAULT 100);

(MySQL, PostgreSQL)
ALTER TABLE
 테이블명 ALTER COLUMN 열이름 SET DEFAULT 100;


7) 설정 해제

ALTER TABLE 테이블명 ALTER 열이름 DROP DEFAULT


8) 열 데이터형 변경

(Oracle)
ALTER TABLE
 테이블명 MODIFY (열이름 변경 후 데이터명);

(MySQL)
ALTER TABLE
 테이블명 MODIFY 열이름 변경 후 데이터형 NOT NULL;


9) 제약 조건 해제

ALTER TABLE
 테이블명 ALTER 열이름 DROP CONSTRAINT UNIQUE;

'old > SQL' 카테고리의 다른 글

Command Line Shell For SQLite  (0) 2010.07.06
외부 키  (0) 2010.03.18
용어  (0) 2010.03.17
TRANSACTION  (0) 2010.03.17
INDEX  (0) 2010.03.17
Posted by jazzlife
,

용어

old/SQL 2010. 3. 17. 18:10

동적 SQL : 상황에 따라 내용이 달라지는 SQL

저장 프로시저 : 일련의 조작을 프로그램으로 묶어서 RDBMS에 저장하는 장치

'old > SQL' 카테고리의 다른 글

외부 키  (0) 2010.03.18
열 구성 변경  (0) 2010.03.18
TRANSACTION  (0) 2010.03.17
INDEX  (0) 2010.03.17
한정 술어  (0) 2010.03.17
Posted by jazzlife
,

TRANSACTION

old/SQL 2010. 3. 17. 17:21
; 일련의 수행과정을 하나로 묶는 것

1) COMMIT : 처리 과정을 확정

BEGIN TRANSACTION;
SELECT...
INSERT...
INSERT...
.
.
.
COMMIT;



2) ROLLBACK : 처리 과정을 취소

BEGIN TRANSACTION;
SELECT...
INSERT...
INSERT...
.
.
.
ROLLBACK;


'old > SQL' 카테고리의 다른 글

열 구성 변경  (0) 2010.03.18
용어  (0) 2010.03.17
INDEX  (0) 2010.03.17
한정 술어  (0) 2010.03.17
집합 연산자  (0) 2010.03.17
Posted by jazzlife
,

INDEX

old/SQL 2010. 3. 17. 17:17
; INDEX SCAN을 위해서 만드는 목차 같은 개념


CREATE
INDEX 인덱스명 ON 테이블명(열이름);
.
.
.
DROP INDEX 인덱스명;

'old > SQL' 카테고리의 다른 글

용어  (0) 2010.03.17
TRANSACTION  (0) 2010.03.17
한정 술어  (0) 2010.03.17
집합 연산자  (0) 2010.03.17
VIEW  (0) 2010.03.17
Posted by jazzlife
,

한정 술어

old/SQL 2010. 3. 17. 17:05

; Sub Query의 결과를 비교 조건으로 사용하고 싶을 때 이용

1) ALL


SELECT menu FROM tbl_menu1 WHERE price > ALL
             (SELECT price FROM tbl_menu1 WHERE menu LIKE '%닭%');


2) EXISTS, NOT EXISTS

SELECT * FROM tbl_menber WHERE EXISTS
               (SELECT name FROM tbl_member WHERE no = 5);

SELECT * FROM tbl_menber WHERE NOT EXISTS
               (SELECT name FROM tbl_member WHERE no = 5);

3) ANY

SELECT name, price FROM tbl_stock WHERE price = ANY (SELECT price FROM tbl_stock WHERE country LIKE 'america');

'old > SQL' 카테고리의 다른 글

TRANSACTION  (0) 2010.03.17
INDEX  (0) 2010.03.17
집합 연산자  (0) 2010.03.17
VIEW  (0) 2010.03.17
JOIN  (0) 2010.03.17
Posted by jazzlife
,

집합 연산자

old/SQL 2010. 3. 17. 16:09
1) UNION : 중복되는 데이터를 정리한 후 가져옴

SELECT  lname, fname FROM tbl_club_a UNION SELECT sung, irum FROM tbl_club_b;


2) UNION ALL : 정리 안 하고 데이터 가져옴 

SELECT  lname, fname FROM tbl_club_a UNION ALL SELECT sung, irum FROM tbl_club_b;


3) INTERSECT : 일치하는 데이터만 가져옴

SELECT  lname, fname FROM tbl_club_a INTERSECT SELECT sung, irum FROM tbl_club_b;



4) EXCEPT (오라클에서는 MINUS)


SELECT  lname, fname FROM tbl_club_a EXCEPT SELECT sung, irum FROM tbl_club_b;

'old > SQL' 카테고리의 다른 글

INDEX  (0) 2010.03.17
한정 술어  (0) 2010.03.17
VIEW  (0) 2010.03.17
JOIN  (0) 2010.03.17
Sub Query  (0) 2010.03.16
Posted by jazzlife
,

VIEW

old/SQL 2010. 3. 17. 15:58
; 자주 사용하는 SELECT문을 등록하여 가상으로 만든 표

테이블 명만 'viw_xxx'로 바꿔주면 된다.

뷰 삭제하기
DROP VIEW viw_tea;

'old > SQL' 카테고리의 다른 글

한정 술어  (0) 2010.03.17
집합 연산자  (0) 2010.03.17
JOIN  (0) 2010.03.17
Sub Query  (0) 2010.03.16
DELETE  (0) 2010.03.16
Posted by jazzlife
,

JOIN

old/SQL 2010. 3. 17. 14:24

; 여러 개의 테이블이나 뷰를 연결


1) CROSS JOIN

SELECT * FROM tbl_a CROSS JOIN tbl_b;
(= SELECT * FROM tbl_a, tbl_b;)

 
id price id name id price id name
1 100 + 1 연필 = 1 100 1 연필
2 250 2 지우개 2 250 1 연필
1 100 2 지우개
2 250 2 지우개
                                                                                       
* 열 지정은 '.'피리어드로 한다. ex) tbl_a.name


2) INNER JOIN

SELECT * FROM tbl_name INNER JOIN tbl_age ON id = no;
(= SELECT * FROM tbl_name, tbl_age WHERE tbl_name.id = tbl_age.no;)

id name no age id name id age
1 kkoma 1 16 1 kkoma 1 16
2 ran + 2 7 = 2 ran 2 7
3 alex 4 14


3) LEFT, RIGHT JOIN

SELECT * FROM tbl_name LEFT JOIN tbl_age ON id = no;
SELECT * FROM tbl_name RIGHT JOIN tbl_age ON id = no;


id name id name id name id age
1 kkoma 1 16 1 kkoma 1 16
2 ran + 2 7 = 2 ran 2 7
3 alex 4 14 3 alex NULL NULL
id name id name id name id age
1 kkoma 1 16 1 kkoma 1 16
2 ran + 2 7 = 2 ran 2 7
3 alex 4 14 NULL NULL 4 14


4) FULL JOIN

SELECT * FROM tbl_name FULL JOIN tbl_age ON id = no;


id name id name id name id age
1 kkoma 1 16 1 kkoma 1 16
2 ran + 2 7 = 2 ran 2 7
3 alex 4 14 NULL NULL 4 14
3 alex NULL NULL

* 예외

(SQL SERVER)
SELECT * FROM tbl_name, tbl_age WHERE  id *= no; <- LEFT JOIN
SELECT * FROM tbl_name, tbl_age WHERE  id =* no; <- RIGHT JOIN

(ORACLE)
SELECT * FROM tbl_name, tbl_age WHERE  id = no(+); <- LEFT JOIN
SELECT * FROM tbl_name, tbl_age WHERE  id = (+)no; <- RIGHT JOIN

'old > SQL' 카테고리의 다른 글

집합 연산자  (0) 2010.03.17
VIEW  (0) 2010.03.17
Sub Query  (0) 2010.03.16
DELETE  (0) 2010.03.16
UPDATE  (0) 2010.03.16
Posted by jazzlife
,

[AlarmController.java]

private OnClickListener mOneShotListener = new OnClickListener() {
        public void onClick(View v) {

            Intent intent = new Intent(AlarmController.this, OneShotAlarm.class);
            PendingIntent sender = PendingIntent.getBroadcast(AlarmController.this,
                    0, intent, 0);

            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(), sender);

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

        }
    };

private OnClickListener mStartRepeatingListener = new OnClickListener() {
        public void onClick(View v) {
       
            Intent intent = new Intent(AlarmController.this, RepeatingAlarm.class);
            PendingIntent sender = PendingIntent.getBroadcast(AlarmController.this,
                    0, intent, 0);
           
            long firstTime = SystemClock.elapsedRealtime();
            firstTime += 15*1000;

      AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
            am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
                            firstTime, 15*1000, sender);.

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

    private OnClickListener mStopRepeatingListener = new OnClickListener() {
        public void onClick(View v) {
         
            Intent intent = new Intent(AlarmController.this, RepeatingAlarm.class);
            PendingIntent sender = PendingIntent.getBroadcast
                                           (AlarmController.this, 0, intent, 0);
           
     AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
            am.cancel(sender);

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



[OneShotAlarm.java]

public class OneShotAlarm extends BroadcastReceiver
{
    @Override
    public void onReceive(Context context, Intent intent)
    {
        Toast.makeText(context, R.string.one_shot_received,
                                  Toast.LENGTH_SHORT).show();
    }
}


[RepeatingAlarm.java]

public class RepeatingAlarm extends BroadcastReceiver
{
    @Override
    public void onReceive(Context context, Intent intent)
    {
        Toast.makeText(context, R.string.repeating_received,
                                         Toast.LENGTH_SHORT).show();
    }
}



[Manifest.xml]

<receiver android:name=".app.OneShotAlarm" android:process=":remote" />

<receiver android:name=".app.RepeatingAlarm" android:process=":remote" />

<activity android:name=".app.AlarmController"
                                    adroid:label="@string/activity_alarm_controller">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.SAMPLE_CODE" />
            </intent-filter>
        </activity>

<service android:name=".app.AlarmService_Service"
                                                            android:process=":remote" />


 

'old > API_Demo' 카테고리의 다른 글

APP_Dialog_AlertDialogSamples  (0) 2010.03.22
APP_Alarm_AlarmService  (0) 2010.03.22
APP_Activity_Wallpaper  (0) 2010.03.16
APP_Activity_TranslucentBlurActivity  (0) 2010.03.16
APP_Activity_TranslucentActivity  (0) 2010.03.16
Posted by jazzlife
,
[Manifest.xml]

        <activity android:name=".app.WallpaperActivity"
                android:label="@string/activity_wallpaper"
                android:theme="@style/Theme.Wallpaper">


[styles.xml]

  <style name="Theme.Wallpaper" parent="android:style/Theme.Wallpaper">
        <item name="android:colorForeground">#fff</item>
    </style>

'old > API_Demo' 카테고리의 다른 글

APP_Alarm_AlarmService  (0) 2010.03.22
APP_Alarm_AlarmController  (0) 2010.03.16
APP_Activity_TranslucentBlurActivity  (0) 2010.03.16
APP_Activity_TranslucentActivity  (0) 2010.03.16
APP_Activity_SetWallpaper  (0) 2010.03.16
Posted by jazzlife
,
[TranslucentBlurActivity.java]

 getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
                WindowManager.LayoutParams.FLAG_BLUR_BEHIND);


[Manifest.xml]

 <activity android:name=".app.TranslucentBlurActivity"
                android:label="@string/activity_translucent_blur"
                android:theme="@style/Theme.Transparent">


[styles.xml] 

<style name="Theme.Translucent" parent="android:style/Theme.Translucent">
<item name="android:windowBackground">
                             @drawable/translucent_background</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:colorForeground">#fff</item>
    </style>

'old > API_Demo' 카테고리의 다른 글

APP_Alarm_AlarmController  (0) 2010.03.16
APP_Activity_Wallpaper  (0) 2010.03.16
APP_Activity_TranslucentActivity  (0) 2010.03.16
APP_Activity_SetWallpaper  (0) 2010.03.16
APP_Activity_ReorderActivities  (0) 2010.03.16
Posted by jazzlife
,
[TranslucentActivity.java]

        <activity android:name=".app.TranslucentActivity"
                android:label="@string/activity_translucent"
                android:theme="@style/Theme.Translucent">


[styles.xml]

<style name="Theme.Translucent" parent="android:style/Theme.Translucent">
<item name="android:windowBackground">
                         @drawable/translucent_background</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:colorForeground">#fff</item>
    </style>

'old > API_Demo' 카테고리의 다른 글

APP_Activity_Wallpaper  (0) 2010.03.16
APP_Activity_TranslucentBlurActivity  (0) 2010.03.16
APP_Activity_SetWallpaper  (0) 2010.03.16
APP_Activity_ReorderActivities  (0) 2010.03.16
APP_Activity_Redirection  (0) 2010.03.16
Posted by jazzlife
,

[SetWallpaperActivity.java]

        final WallpaperManager wallpaperManager =
                               WallpaperManager.getInstance(this);
        final Drawable wallpaperDrawable = wallpaperManager.getDrawable();
        final ImageView imageView = (ImageView) findViewById(R.id.imageview);

        imageView.setDrawingCacheEnabled(true);
        imageView.setImageDrawable(wallpaperDrawable);

        Button randomize = (Button) findViewById(R.id.randomize);
        randomize.setOnClickListener(new OnClickListener() {
            public void onClick(View view) {
                int mColor = (int) Math.floor(Math.random() * mColors.length);
                wallpaperDrawable.setColorFilter(mColors[mColor],
                                                             PorterDuff.Mode.MULTIPLY);
                imageView.setImageDrawable(wallpaperDrawable);
                imageView.invalidate();
            }
        });

        Button setWallpaper = (Button) findViewById(R.id.setwallpaper);
        setWallpaper.setOnClickListener(new OnClickListener() {
            public void onClick(View view) {
                try {
                    wallpaperManager.setBitmap(imageView.getDrawingCache());
                    finish();
                } catch (IOException e) {
                    e.printStackTrace();
                }



* Drawable class로 그림을 그리고 WallpaperManager로 바탕화면을 지정한다.

'old > API_Demo' 카테고리의 다른 글

APP_Activity_TranslucentBlurActivity  (0) 2010.03.16
APP_Activity_TranslucentActivity  (0) 2010.03.16
APP_Activity_ReorderActivities  (0) 2010.03.16
APP_Activity_Redirection  (0) 2010.03.16
APP_Activity_ReceiveResult  (0) 2010.03.16
Posted by jazzlife
,
[ReorderFour.java]

            Intent intent = new Intent(ReorderFour.this, ReorderTwo.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
            startActivity(intent);


* FLAG_ACTIVITY_REORDER_TO_FRONT는 ReorderTwo.class를 stack의 가장 위로 이동시킨다.

'old > API_Demo' 카테고리의 다른 글

APP_Activity_TranslucentActivity  (0) 2010.03.16
APP_Activity_SetWallpaper  (0) 2010.03.16
APP_Activity_Redirection  (0) 2010.03.16
APP_Activity_ReceiveResult  (0) 2010.03.16
APP_Activity_Persistent State  (0) 2010.03.15
Posted by jazzlife
,
[RedirectEnter]
 
           Intent intent = new Intent(RedirectEnter.this, RedirectMain.class);
           startActivity(intent);


[RedirectMain.java]

    static final int INIT_TEXT_REQUEST = 0;
    static final int NEW_TEXT_REQUEST = 1;


  @Override
 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.redirect_main);

          if (!loadPrefs()) {
            Intent intent = new Intent(this, RedirectGetter.class);
            startActivityForResult(intent, INIT_TEXT_REQUEST);
}


 @Override
 protected void onActivityResult(int requestCode, int resultCode,
  Intent data) {
        if (requestCode == INIT_TEXT_REQUEST) {

            if (resultCode == RESULT_CANCELED) {
                finish();

            } else {
                loadPrefs();
            }

        } else if (requestCode == NEW_TEXT_REQUEST) {

            if (resultCode != RESULT_CANCELED) {
                loadPrefs();
            }

        }
    }

  private final boolean loadPrefs() {
  SharedPreferences preferences = getSharedPreferences("RedirectData", 0);
        mTextPref = preferences.getString("text", null);
        if (mTextPref != null) {
            TextView text = (TextView)findViewById(R.id.text);
            text.setText(mTextPref);
            return true;
        }
        return false;
    }
    private OnClickListener mClearListener = new OnClickListener() {
        public void onClick(View v) {
   
SharedPreferences preferences = getSharedPreferences("RedirectData", 0);
            preferences.edit().remove("text").commit();
            finish();
        }
    };
    private OnClickListener mNewListener = new OnClickListener() {
        public void onClick(View v) {
         
            Intent intent = new Intent(RedirectMain.this, RedirectGetter.class);
         startActivityForResult(intent, NEW_TEXT_REQUEST);
        }
    };
    private String mTextPref;
}







[RedirectGetter.java]

 private final boolean loadPrefs()
    {

   SharedPreferences preferences = getSharedPreferences("RedirectData", 0);

        mTextPref = preferences.getString("text", null);
        if (mTextPref != null) {
            mText.setText(mTextPref);
            return true;

        }

        return false;
    }

    private OnClickListener mApplyListener = new OnClickListener()
    {
        public void onClick(View v)
        {
   SharedPreferences preferences = getSharedPreferences("RedirectData", 0);
  SharedPreferences.Editor editor = preferences.edit();
  editor.putString("text", mText.getText().toString());

            if (editor.commit()) {
                setResult(RESULT_OK);

            }

            finish();
        }
    };


// "RedirectData"는 String name, "text"는 String key

** RedirectEnter.java에서 RedirectMain.java를 호출하고 RedirectMain은 prefrences의 내용 유무에 따라서 sub activity를 실행하여 그 데이터를 저장하고 출력한다. **

'old > API_Demo' 카테고리의 다른 글

APP_Activity_SetWallpaper  (0) 2010.03.16
APP_Activity_ReorderActivities  (0) 2010.03.16
APP_Activity_ReceiveResult  (0) 2010.03.16
APP_Activity_Persistent State  (0) 2010.03.15
APP_Activity_Hello World  (0) 2010.03.15
Posted by jazzlife
,

[ReceiveResult.java]

@Override
 protected void onActivityResult(int requestCode, int resultCode,
  Intent data) {
     
        if (requestCode == GET_CODE) {

            Editable text = (Editable)mResults.getText();

            if (resultCode == RESULT_CANCELED) {
                text.append("(cancelled)");

             } else {
                text.append("(okay ");
                text.append(Integer.toString(resultCode));
                text.append(") ");
                if (data != null) {
                    text.append(data.getAction());
                }
            }

            text.append("\n");
        }
    }


    static final private int GET_CODE = 0;

    private OnClickListener mGetListener = new OnClickListener() {
        public void onClick(View v) {
       
            Intent intent = new Intent (ReceiveResult.this, SendResult.class);
          startActivityForResult(intent, GET_CODE);
        }
    };


[SendResult.java]

 private OnClickListener mCorkyListener = new OnClickListener()
    {
        public void onClick(View v)
        {
            setResult(RESULT_OK, (new Intent()).setAction("Corky!"));
          finish();
        }
    };

    private OnClickListener mVioletListener = new OnClickListener()
    {
        public void onClick(View v)
        {
            setResult(RESULT_OK, (new Intent()).setAction("Violet!"));
            finish();
        }
    };
}



Activity는 RESULT_OK, RESULT_CANCELED,RESULT_FIRST_USER 를 반환한다.

'old > API_Demo' 카테고리의 다른 글

APP_Activity_ReorderActivities  (0) 2010.03.16
APP_Activity_Redirection  (0) 2010.03.16
APP_Activity_Persistent State  (0) 2010.03.15
APP_Activity_Hello World  (0) 2010.03.15
APP_Activity_Forwarding  (0) 2010.03.15
Posted by jazzlife
,

Sub Query

old/SQL 2010. 3. 16. 14:58

1) WHERE 절에서 사용

SELECT * FROM tbl_cake WHERE price >= (SELECT AVG(price) FROM tbl_cake);


2) HAVING 절에서 사용

SELECT code, MIN(arrival) FROM tbl_stock GROUP BY code
            HAVING MIN(arrival) < (SELECT AVG(shipment) FROM tbl_stock);



3) FROM 절에서 사용

SELECT MIN(price)
            FROM (SELECT * FROM tbl_cake WHERE price >= 2500) AS c_price;



* 응용

INSERT INTO tbl_advance SELECT * FROM tbl_results
    WHERE point1 + point2  > (SELECT AVG(point1 + point2) FROM tbl_results);

UPDATE tbl_allowance SET total = (overtime + travel)
     WHERE overtime + travel < (SELECT MAX(overtitme) FROM tbl_allowance);

DELETE FROM tbl_allowance WHERE travel > (SELECT AVG(travel)
            FROM tbl_allowance WHERE overtime >= 40000);

'old > SQL' 카테고리의 다른 글

VIEW  (0) 2010.03.17
JOIN  (0) 2010.03.17
DELETE  (0) 2010.03.16
UPDATE  (0) 2010.03.16
INSERT  (0) 2010.03.16
Posted by jazzlife
,

DELETE

old/SQL 2010. 3. 16. 14:44

1) 조건과 일치하는 데이터 삭제

DELETE FROM tbl_tel WHERE name = '박화정';



2) 모든 데이터 삭제하기

DELETE FROM tbl_tel;

'old > SQL' 카테고리의 다른 글

JOIN  (0) 2010.03.17
Sub Query  (0) 2010.03.16
UPDATE  (0) 2010.03.16
INSERT  (0) 2010.03.16
변환 함수 (CAST)  (0) 2010.03.15
Posted by jazzlife
,

UPDATE

old/SQL 2010. 3. 16. 14:17
; 등록된 값을 수정하기 위해서 사용한다.

1) 하나의 값 수정하기

UPDATE tbl_lunch SET price=7600 WHERE code = 2;


2) 여러 값 수정하기

UPDATE tbl_lunch SET menu='오늘의 런치', price=7900 WHERE code = 1;



'old > SQL' 카테고리의 다른 글

Sub Query  (0) 2010.03.16
DELETE  (0) 2010.03.16
INSERT  (0) 2010.03.16
변환 함수 (CAST)  (0) 2010.03.15
집합 함수 (AVG, SUM, COUNT, MAX, MIN)  (0) 2010.03.15
Posted by jazzlife
,

INSERT

old/SQL 2010. 3. 16. 14:09

1) 열 이름 생략하고 등록하기

INSERT INTO tbl_tea VALUES (2, '홍차', 8500);




2) 특정 열에만 값 등록하기

INSERT INTO tbl_tea (name, code) VALUES ('구기자차', 3);




3) 다른 테이블에 있는 자료 가져오기

INSERT INTO tbl_petlist (id, name) SELECT no, name FROM tbl_cat;

'old > SQL' 카테고리의 다른 글

DELETE  (0) 2010.03.16
UPDATE  (0) 2010.03.16
변환 함수 (CAST)  (0) 2010.03.15
집합 함수 (AVG, SUM, COUNT, MAX, MIN)  (0) 2010.03.15
날짜함수 (GETDATE, DAY, MONTH, YEAR, DATEADD, DATEDIFF  (0) 2010.03.15
Posted by jazzlife
,
Iterator : iterator()는 Collection Interface에 정의된 method. List와 Set에도 포함되어 있다. 

boolean hasNext() 읽어 올 요소가 있는지. true, false
Object next() 다음 요소를 읽어 옴
void remove() next()로 읽어 온 요소를 삭제. (옵션기능)

ex)
List list = new ArrayList();
Iterator it = list.iterator();
while(it.hasNext()) {
...
}


* Map 인터페이스를 구현한 컬렉션 클래스는 키와 값을 쌍으로 저장하고 있어서 iterator 직접 호출이 불가능 하다. *

ex)
Map map = new HashMap();
...
Iterator it = map.keySet().iterator();

또는

Set eSet =  map.entrySet();
Iterator it = eSet.iterator();


리턴값을 이용해 또 다른 메서드를 호출하는 방법으로 map.ketSet().iterator() 이용한 것
ex)
StringBuffer sb = new StringBuffer();
sb.append("A").sb.append("B").sb.append("C");


Iterator 와 ListIterator의 차이점 : Iterator는 단방향 접근, ListIterator는 양방향 접근


'old > JAVA' 카테고리의 다른 글

Collection Framework  (0) 2010.05.24
garbage collection 이란?  (0) 2010.05.10
Stack & Queue  (0) 2010.03.15
Deep Copy vs Shallow Copy  (0) 2010.03.15
JAVA Grammer  (0) 2010.03.15
Posted by jazzlife
,

example of SharedPreferences

[PersistentState.java]


    @Override
    protected void onResume() {
        super.onResume();

        SharedPreferences prefs = getPreferences(0);
        String restoredText = prefs.getString("text", null);
        if (restoredText != null) {
            mSaved.setText(restoredText, TextView.BufferType.EDITABLE);

            int selectionStart = prefs.getInt("selection-start", -1);
            int selectionEnd = prefs.getInt("selection-end", -1);
            if (selectionStart != -1 && selectionEnd != -1) {
                mSaved.setSelection(selectionStart, selectionEnd);
            }
        }
    }

    @Override
    protected void onPause() {
        super.onPause();

        SharedPreferences.Editor editor = getPreferences(0).edit();
        editor.putString("text", mSaved.getText().toString());
        editor.putInt("selection-start", mSaved.getSelectionStart());
        editor.putInt("selection-end", mSaved.getSelectionEnd());
        editor.commit();
    }

    private EditText mSaved;
}



[Manifest.xml]

<activity android:name=".app.PersistentState"
             android:label="@string/activity_persistent"
      android:windowSoftInputMode="stateVisible|adjustResize"> - 소프트 입력키
            <intent-filter>



[save_restore_state.xml]

    <EditText android:id="@+id/saved"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@drawable/green"
        android:text="@string/initial_text"
        android:freezesText="true"> - 뷰에 기본으로 출력 될 텍스트
        <requestFocus /> - 포커스를 지정


'old > API_Demo' 카테고리의 다른 글

APP_Activity_Redirection  (0) 2010.03.16
APP_Activity_ReceiveResult  (0) 2010.03.16
APP_Activity_Hello World  (0) 2010.03.15
APP_Activity_Forwarding  (0) 2010.03.15
APP_Activity_Dialog  (0) 2010.03.15
Posted by jazzlife
,
[strings.xml]

    <string name="activity_hello_world"><b>Hello <i>World</i></b></string>
    <string name="hello_world"><b>Hello, <i>World!</i></b></string>


* html tag 사용
   <b> bold, <i> italic

  

'old > API_Demo' 카테고리의 다른 글

APP_Activity_ReceiveResult  (0) 2010.03.16
APP_Activity_Persistent State  (0) 2010.03.15
APP_Activity_Forwarding  (0) 2010.03.15
APP_Activity_Dialog  (0) 2010.03.15
APP_Activity_Custom Title  (0) 2010.03.15
Posted by jazzlife
,

[Forwarding.java]

      Button goButton = (Button)findViewById(R.id.go);
        goButton.setOnClickListener(mGoListener);
    }

    private OnClickListener mGoListener = new OnClickListener()
    {
        public void onClick(View v)
        {
            Intent intent = new Intent();
            intent.setClass(Forwarding.this, ForwardTarget.class);
            startActivity(intent);
            finish();

        }
    };



[ForwardTarget.java]

-



[Manifest.xml]

//추가//

        <activity android:name=".app.ForwardTarget">
        </activity>



 

'old > API_Demo' 카테고리의 다른 글

APP_Activity_Persistent State  (0) 2010.03.15
APP_Activity_Hello World  (0) 2010.03.15
APP_Activity_Dialog  (0) 2010.03.15
APP_Activity_Custom Title  (0) 2010.03.15
APP_Activiy_Custom Dialog  (0) 2010.03.15
Posted by jazzlife
,