1) 조회 결과를 저장할 Value Object Class 선언
public class Addressbook {
private String name;
private String phnnumber;
public void setPhnnumber(String phnnumber) {
this.phnnumber = phnnumber;
}
public String getPhnnumber() {
return phnnumber;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
2) Contacts 조회 Method Sample
protected Addressbook[] getFriendsfromAddressBook()
{
String[] projection = new String[] { Phone.DISPLAY_NAME, Phone.NUMBER };
Cursor c = getContentResolver().query( Phone.CONTENT_URI, projection, null, null, null);
Addressbook[] addressfriend = new Addressbook[ c.getCount() ];
c.moveToFirst();
int idx = 0;
String bookname = null;
String booknum = null;
try {
if ( ! c.isAfterLast() )
{
do
{
bookname = c.getString( 0 );
booknum = c.getString( 1 );
addressfriend[idx] = new Addressbook();
addressfriend[idx].setName( bookname );
addressfriend[idx].setPhnnumber( booknum );
idx++;
} while ( c.moveToNext() );
}
} catch (Exception e ) {
showToastMsg ( "주소록 정보를 가져올 수 없습니다.\n" + e.toString());
return null;
}
finally {
c.close();
}
return addressfriend;
}
2011년 12월 1일 목요일
Android 용 Eclipse 환경 설정
1) eclipse 3.5 version 이상 download
URL : http://www.eclipse.org/downloads/
2) android 용 SDK download
URL : http://developer.android.com/sdk/index.html
3) eclipse 실행 후, Android 용 ADT (Android Development Tool) Install
eclipse -> help -> Install New Software : https://dl-ssl.google.com/android/eclipse/.
4) eclipse -> windows -> preferences -> android 에서 Android SDK 의 Home 디렉토리 설정
5) eclipse -> windows -> Android SDK and AVD Manager -> Available Packages 에서 원하는 Package 선택 후, Install
URL : http://www.eclipse.org/downloads/
2) android 용 SDK download
URL : http://developer.android.com/sdk/index.html
3) eclipse 실행 후, Android 용 ADT (Android Development Tool) Install
eclipse -> help -> Install New Software : https://dl-ssl.google.com/android/eclipse/.
4) eclipse -> windows -> preferences -> android 에서 Android SDK 의 Home 디렉토리 설정
5) eclipse -> windows -> Android SDK and AVD Manager -> Available Packages 에서 원하는 Package 선택 후, Install
Android Widget 생성
1) AndroidManifest.xml 에 AppWidget 선언
<receiver android:name="phoneinfoWidgetProvider" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/phoneinfo_provider" />
</receiver>
2) 1)에서 정의한 android:resource="@xml/phoneinfo_provider" 의 설정에 따라 /res/xml 디렉토리에 phoneinfo_provider.xml 파일을 생성하여 AppWidgetProviderInfo Meta Data 추가
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="294dp"
android:minHeight="72dp"
android:updatePeriodMillis="30000"
android:initialLayout="@layout/phoneinfo_widget"
android:configure="com.shlee.pi.PhoneInfoWidgetConfigure" >
</appwidget-provider>
3) App Widget Layout 선언 (phoneinfo_widget.xml)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_widget"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
>
<TextView android:id="@+id/label_attr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#FFAA00"/>
<TextView android:id="@+id/value_attr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/label_attr"
android:gravity="right"
android:layout_gravity="right"
android:textSize="14sp"
android:textColor="#FFF" />
</RelativeLayout>
<receiver android:name="phoneinfoWidgetProvider" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/phoneinfo_provider" />
</receiver>
2) 1)에서 정의한 android:resource="@xml/phoneinfo_provider" 의 설정에 따라 /res/xml 디렉토리에 phoneinfo_provider.xml 파일을 생성하여 AppWidgetProviderInfo Meta Data 추가
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="294dp"
android:minHeight="72dp"
android:updatePeriodMillis="30000"
android:initialLayout="@layout/phoneinfo_widget"
android:configure="com.shlee.pi.PhoneInfoWidgetConfigure" >
</appwidget-provider>
3) App Widget Layout 선언 (phoneinfo_widget.xml)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_widget"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
>
<TextView android:id="@+id/label_attr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#FFAA00"/>
<TextView android:id="@+id/value_attr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/label_attr"
android:gravity="right"
android:layout_gravity="right"
android:textSize="14sp"
android:textColor="#FFF" />
</RelativeLayout>
Windows XP 에서 한글 전환 오류 해결방법
Windows XP 의 노트패드 등에서 한글 전환등이 안되서,
며칠간 윈도우 업데이트부터 해서 이것저것 설정을 바꿔도 안되더니만...
아래 reg 파일을 실행하여 Registry 를 update 하니 며칠간의 고민이 바로 해결되었음..ㅎ
아래 내용을 노트패드 등에서 파일명을 hotkey.reg 로 하여 붙여넣은 후,
실행하여 registry 를 업뎃~!! ^^
==== 아래 =========================================
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Input Method]
"Show Status"="1"
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys]
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000010]
"Key Modifiers"=hex:02,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:20,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000011]
"Key Modifiers"=hex:04,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:20,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000012]
"Key Modifiers"=hex:02,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:be,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000070]
"Key Modifiers"=hex:02,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:20,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000071]
"Key Modifiers"=hex:04,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:20,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000072]
"Key Modifiers"=hex:03,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:bc,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000200]
"Key Modifiers"=hex:03,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:47,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000201]
"Key Modifiers"=hex:03,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:4b,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000202]
"Key Modifiers"=hex:03,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:4c,00,00,00
며칠간 윈도우 업데이트부터 해서 이것저것 설정을 바꿔도 안되더니만...
아래 reg 파일을 실행하여 Registry 를 update 하니 며칠간의 고민이 바로 해결되었음..ㅎ
아래 내용을 노트패드 등에서 파일명을 hotkey.reg 로 하여 붙여넣은 후,
실행하여 registry 를 업뎃~!! ^^
==== 아래 =========================================
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Input Method]
"Show Status"="1"
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys]
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000010]
"Key Modifiers"=hex:02,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:20,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000011]
"Key Modifiers"=hex:04,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:20,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000012]
"Key Modifiers"=hex:02,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:be,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000070]
"Key Modifiers"=hex:02,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:20,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000071]
"Key Modifiers"=hex:04,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:20,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000072]
"Key Modifiers"=hex:03,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:bc,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000200]
"Key Modifiers"=hex:03,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:47,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000201]
"Key Modifiers"=hex:03,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:4b,00,00,00
[HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000202]
"Key Modifiers"=hex:03,c0,00,00
"Target IME"=hex:00,00,00,00
"Virtual Key"=hex:4c,00,00,00
피드 구독하기:
글 (Atom)