I am new to fragment concept. In my app I have to save user preferences. I have gone through this doc.
Prepared my preferences xml file and PreferenceFragment file. Everything is fine up to now.
My problem is, I have to add the following code in my onCreate()
method of my MainActivity
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new SettingsFragment())
.commit();
It is showing on Main screen. But I want to launch this on a button click method
onSettingsClicked(){
// launch preferces screen
}
And I want to display it as a separate screen. How can I do that?