0

I'm having an android application which has only one activity. Any UI changes etc are made on fragments. But I want to implement a preference settings screen as tablet style view.

enter image description here

The problem is that i have to implement that feature in fragment. As I see everywhere - everybody add it by using activity (PreferenceActivity). Is there any hack or something to be able to call "onBuildHeaders" and "loadHeadersFromResource"?

Barak
  • 1,390
  • 15
  • 27
Ace
  • 47
  • 6

1 Answers1

0

Actually the preferred way is a preference fragment. and most of the activities are really use fragments internally. this is a useful link;

Prefs

example

this might be closer

  • I wrote "Fragment" by having on mind "PreferenceFragment". But there is no "onBuildHeaders" function, so cannot load preference-headers. – Ace Apr 04 '19 at 18:27
  • I added a link that might be closer to what you need. – keepTrackOfYourStack Apr 04 '19 at 19:32
  • Still not. Don't you see in these examples that preference-headers are loaded in activity? I can't do that. I need to build multi-pane in main fragment... – Ace Apr 05 '19 at 07:39
  • In the 3rd link the post uses an activity to display the headers and a fragment to display the preferences for the selected header. That's all I found. – keepTrackOfYourStack Apr 05 '19 at 17:30