I already made some Apps in Android and noticed that I am often using static methods.
For example I have an Class which extends PreferenceFragment. In t
You can use a Java property known as mirroring. Below I use the property to finish the activity.
Button btn = new Button(getActivity().getApplicationContext());
btn.setText("Save");
v.addView(btn);
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
SettingsFragment.this.getActivity().finish();
}
});