I want to add a couple buttons to the bottom of my preferences screen for setting defaults and restoring defaults. This answer doesn\'t cover how to do this using PreferenceFrag
you may try this
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// TODO Auto-generated method stub
LinearLayout v = (LinearLayout) super.onCreateView(inflater, container, savedInstanceState);
Button SendLogbtn = new Button(getActivity().getApplicationContext());
SendLogbtn.setText("send log file");
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
params.setMargins(100, 0, 0, 500);
SendLogbtn.setLayoutParams(params);
v.addView(SendLogbtn);
SendLogbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// do your code
}
});
return v;
}