tag:blogger.com,1999:blog-6448662061443250172.post4979606043726419811..comments2023-10-26T06:45:36.127-07:00Comments on Professional Android Development: Honeycomb Tip #1: PreferenceFragmentAnonymoushttp://www.blogger.com/profile/17641882082996753477noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-6448662061443250172.post-14307342096094614842013-02-19T23:42:32.093-08:002013-02-19T23:42:32.093-08:00You probably figured this out by now, but for othe...You probably figured this out by now, but for others the code to publish the prefFrag from Main Activity is:<br /><br />public class SettingsActivity extends Activity {<br /> @Override<br /> protected void onCreate(Bundle savedInstanceState) {<br /> super.onCreate(savedInstanceState);<br /><br /> // Display the fragment as the main content.<br /> getFragmentManager().beginTransaction()<br /> .replace(android.R.id.content, new SettingsFragment())<br /> .commit();<br /> }<br />}<br /><br />from http://developer.android.com/guide/topics/ui/settings.html#FragmentAnonymoushttps://www.blogger.com/profile/16089345382490806622noreply@blogger.comtag:blogger.com,1999:blog-6448662061443250172.post-26188837268039642772013-02-19T23:39:22.621-08:002013-02-19T23:39:22.621-08:00Haha, nevermind, I got this to work, this article ...Haha, nevermind, I got this to work, this article is the correct solution to Jgomes problema. Just make sure you use the same replace(R.id,...) in the onPrefTreeClick overide as you do in the replace(R.id,...) in the activity. Thanks RobAnonymoushttps://www.blogger.com/profile/16089345382490806622noreply@blogger.comtag:blogger.com,1999:blog-6448662061443250172.post-41769772119560333232013-02-19T23:29:50.275-08:002013-02-19T23:29:50.275-08:00I'm having the same problem. kind of irritatin...I'm having the same problem. kind of irritating me that I even tried using fragments. To get this to work properly I created a new activity for each prefscreen... Might just be the Full Screen Activity theme...Anonymoushttps://www.blogger.com/profile/16089345382490806622noreply@blogger.comtag:blogger.com,1999:blog-6448662061443250172.post-72518032329572009702012-02-09T13:01:43.154-08:002012-02-09T13:01:43.154-08:00All you should need to do is swap your preferencef...All you should need to do is swap your preferencefragment into the framelayout that you defined for your screen. It's no different than swapping in any other fragment actually.<br /><br />So basically you will need to have a portion of your screen set in your layout as a FrameLayout and you can put any fragment inside that FrameLayout you want.<br /><br />You should read this page on Fragments. It will help sort you out.<br />http://developer.android.com/guide/topics/fundamentals/fragments.htmlAnonymoushttps://www.blogger.com/profile/17641882082996753477noreply@blogger.comtag:blogger.com,1999:blog-6448662061443250172.post-16633348072246859292012-02-09T12:20:26.970-08:002012-02-09T12:20:26.970-08:00could you please supply the code of actually launc...could you please supply the code of actually launching the preference screen from main. I think I am missing something.. specifically how the PreferenceFragment is contained. I tried using it as an Intent to my PreferenceFragment class, but PreferenceFragement isnt an activity so that doesnt work. Do I nest the Frag in some activity (is this the FragmentView?) and then explicity start an intent to that class?swightnesshttps://www.blogger.com/profile/06559804288191328210noreply@blogger.comtag:blogger.com,1999:blog-6448662061443250172.post-18307843135844153612011-06-29T04:32:54.470-07:002011-06-29T04:32:54.470-07:00I have a similar problem, I load a fragment with a...I have a similar problem, I load a fragment with a webpage, and when clic on button of preference I can replace this fragment by the PrefrenceFragment, but this preference appear over the previos fragment, How Can I remove the previos fragment??Jgomeshttps://www.blogger.com/profile/07669280038061247032noreply@blogger.com