LogCat中错误提示如下:
05-13 22:27:14.195: E/AndroidRuntime(4714): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.tts/com.my.tts.TtsPreferenceActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class com.my.tts.TtsPreferenceActivity.SeekBarPreference
05-13 22:27:14.195: E/AndroidRuntime(4714): Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class com.my.tts.TtsPreferenceActivity.SeekBarPreference
05-13 22:27:14.195: E/AndroidRuntime(4714): at com.my.tts.TtsPreferenceActivity.onCreate(TtsPreferenceActivity.java:30)
由LogCat中的提示内容可知错误出现在Binary XML file line #13: Error inflating class com.my.tts.TtsPreferenceActivity.SeekBarPreference和at com.my.tts.TtsPreferenceActivity.onCreate(TtsPreferenceActivity.java:30)这两个地方,其实还是由一个错误原因导致两处产生了错误。
Binary XML file line #13这个地方的内容如下图所示:
com.my.tts.TtsPreferenceActivity.onCreate(TtsPreferenceActivity.java:30)处的内容如下:
从上面得知错误的原因是在preference_tts这个xml文件中的第13行
解决办法:
改成下面这样就把错误解决了