O'Reilly logo

Reactive Android Programming by Tadas Subonis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating Settings activity

We will start by creating an activity for Settings:

import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;public class SettingsActivity extends RxAppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);}

Then, we will add it to AndroidManifest.xml:

<activity android:name=".SettingsActivity" />

Next, we will use PreferenceFragment by forming a SettingsFragment class inside the SettingsActivity to provide the preferences UI:

public static class SettingsFragment extends PreferenceFragment {    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        addPreferencesFromResource(R.xml.preferences); } ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required