I\'m quite new to Android Development and just came across Preferences.
I found PreferenceScreen and wanted to create a login functionality with it. The only pr
Create a custom layout for the SettingsFragment.java i.e layout_settings.xml
Then, refer to the layout file in your styles.xml:
And then, in the onViewCreated() method of your SettingsFragment.java, you
can use the button like this:
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle
savedInstanceState) {
MaterialButton btnSample = view.findViewById(R.id.btnSample);
btnSample.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(requireContext(), "Sample Button
clicked!!", Toast.LENGTH_LONG).show();
}
});
}