I am making an app that you can make and remove tabs. I want to make 2 buttons that you can create a tab and remove a tab. I want the buttons to be in the same activity as where the settings are, but it seems not to work.
Here is my AppPreferences:
public class AppPreferences extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
}
public void createtab(View view){
Toast.makeText(AppPreferences.this, "Button 1", Toast.LENGTH_SHORT).show();
}
public void removetab(View view){
Toast.makeText(AppPreferences.this, "Button 2", Toast.LENGTH_SHORT).show();
}
and this is my layout:
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Create Tab"
android:id="@+id/createtab"
android:onClick="createtab"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
/>
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Remove Tab"
android:id="@+id/removetab"
android:onClick="removetab"
android:layout_alignBottom="@+id/createtab"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
/>
Thanks for reading and I hope you can help me!