2014년 7월 4일 금요일

Android PreferenceActivity

설정 화면을 위한 액티비티



package com.example.preference;
import android.content.Context;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import com.example.test.R;
public class SettingsActivity extends PreferenceActivity {
    private static final String TAG = "SettingsActivity";
    private Context mContext = null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = this;
        
        addPreferencesFromResource(R.xml.preference_settings);
    }
}


<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
    <PreferenceCategory android:title="settings" >
        <EditTextPreference
            android:dialogTitle="edittext"
            android:key="edittext_key"
            android:summary="edittext_summary"
            android:title="edittext_title" />
    </PreferenceCategory>
</PreferenceScreen>