Custom Preference

Preference is setting page for Android.
Android provides several Preference type for setting.

But, sometimes we need special custom setting.
In that case, we can extend Preference class and use it as preference.


Open Web page Preference

public class WebPreference extends Preference
	private String url = "";
	public WebPreference(Context context, AttributeSet attrs) 
		super(context, attrs);

	protected void onClick ( )
		Uri uri = Uri.parse(url);
		Intent intent = new Intent(Intent.ACTION_VIEW, uri);

The main method is onClick.

How to use?
It is just as same other Preference(.xml)

<PreferenceCategory android:title="@string/web">