Here is a part of my preference.xml.
<Preference
android:summary="Write me"
android:title="Title">
<intent
android:action="android.intent.action.VIEW"
android:data="mailto:support@xxxxx.com"
/>
</Preference>
When i'm clicking to this preference i have a crash with
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=mailto:xxxxxx.x@x-xxxxxx.xxx }
What do i do wrong?
This is my class for preference. I read lots of theads but don't find an answer :
public class Preferences extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
public static final String KEY_PREF_INSTANT_PRINT = "instantPrinting";
public static final String KEY_PREF_INSTANT_PRINT_SCREEN = "instantPrintingScreen";
public static final String KEY_PREF_PAY_BUTTONS = "paymentTypes";
@Override
protected void onResume() {
super.onResume();
getPreferenceScreen().getSharedPreferences()
.registerOnSharedPreferenceChangeListener(this);
}
@Override
protected void onPause() {
super.onPause();
getPreferenceScreen().getSharedPreferences()
.unregisterOnSharedPreferenceChangeListener(this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
addPreferencesFromResource(R.xml.preference);
Preference instantPrintingScreen = findPreference(KEY_PREF_INSTANT_PRINT_SCREEN);
instantPrintingScreen.setEnabled(sharedPref.getBoolean(KEY_PREF_INSTANT_PRINT, false));
}
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
if (key.equals(KEY_PREF_INSTANT_PRINT)) {
Preference connectionPref = findPreference(KEY_PREF_INSTANT_PRINT_SCREEN);
connectionPref.setEnabled(sharedPreferences.getBoolean(key, false));
}
}
}