Customize Android PreferenceFragment not working -



Customize Android PreferenceFragment not working -

currently 2.x preference screens, in every preferenceactivity add together line setcontentview(r.layout.activity_preferences); have custom layout in activities.

the activity_preferences.xml layout file looks this:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <linearlayout style="@style/titlebar"> <imagebutton style="@style/titlebaraction" android:src="@drawable/ic_title_home" android:onclick="onhomeclick" /> <imageview style="@style/titlebarseparator" /> <eu.vranckaert.worktime.utils.view.customtextview style="@style/titlebartext" android:text="@string/lbl_preferences_title"/> </linearlayout> <listview android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@android:id/list"/> </linearlayout>

for 3.x , application building preferences according illustration on here: http://developer.android.com/reference/android/preference/preferenceactivity.html.

in order apply same layout 3.x app, tried add together setcontentview(..) in 3.x preferenceactivity.

result on phone: works fine on first activity, when loading fragment (with real preferences in them) style not applied

result on tablet: crash:

error/androidruntime(2208): fatal exception: main java.lang.runtimeexception: unable start activity componentinfo{eu.vranckaert.worktime/eu.vranckaert.worktime.activities.preferences.preferencesicsactivity}: java.lang.illegalargumentexception: no view found id 0x10202d4 fragment timeregistrationspreferencesfragment{4101ed38 #0 id=0x10202d4} @ android.app.activitythread.performlaunchactivity(activitythread.java:1956) @ android.app.activitythread.handlelaunchactivity(activitythread.java:1981) @ android.app.activitythread.access$600(activitythread.java:123) @ android.app.activitythread$h.handlemessage(activitythread.java:1147) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:4424) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:784) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:551) @ dalvik.system.nativestart.main(native method) caused by: java.lang.illegalargumentexception: no view found id 0x10202d4 fragment timeregistrationspreferencesfragment{4101ed38 #0 id=0x10202d4} @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:822) @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1032) @ android.app.backstackrecord.run(backstackrecord.java:622) @ android.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:1382) @ android.app.activity.performstart(activity.java:4474) @ android.app.activitythread.performlaunchactivity(activitythread.java:1929) ... 11 more

when seek apply layout file on fragments using getactivity().setcontentview(r.layout.activity_preferences); result is: phone: activity still shown fine, when going category crashes:

error/androidruntime(1320): fatal exception: main java.lang.runtimeexception: unable start activity componentinfo{eu.vranckaert.worktime/eu.vranckaert.worktime.activities.preferences.preferencesicsactivity}: java.lang.illegalargumentexception: no view found id 0x10202d4 fragment datetimepreferencesfragment{412a0d78 #0 id=0x10202d4} @ android.app.activitythread.performlaunchactivity(activitythread.java:1956) @ android.app.activitythread.handlelaunchactivity(activitythread.java:1981) @ android.app.activitythread.access$600(activitythread.java:123) @ android.app.activitythread$h.handlemessage(activitythread.java:1147) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:4424) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:784) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:551) @ dalvik.system.nativestart.main(native method) caused by: java.lang.illegalargumentexception: no view found id 0x10202d4 fragment timeregistrationspreferencesfragment{412a0d78 #0 id=0x10202d4} @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:822) @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1032) @ android.app.backstackrecord.run(backstackrecord.java:622) @ android.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:1382) @ android.app.activity.performstart(activity.java:4474) @ android.app.activitythread.performlaunchactivity(activitythread.java:1929) ... 11 more

for tablet: same crash before...

how should apply layout file fragment activity...? or should create new layout file?

android android-layout android-preferences android-3.0-honeycomb android-4.0

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -