//////////////////////////////////////////////// MainActivity /////////////////////////////////////////////////////
package com.example.backgroundexam;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
public class MainActivity extends Activity {
public boolean SWITCH = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnBackground = (Button)findViewById(R.id.btnBackground);
btnBackground.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
LinearLayout background = (LinearLayout)findViewById(R.id.background);
if(SWITCH)
{
background.setBackgroundResource(R.drawable.photo1);
SWITCH = false;
}
else{
background.setBackgroundResource(R.drawable.photo2);
SWITCH = true;
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
<!-----------------------------activity_main.xml ---------------------------------------------->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/photo1"
android:id="@+id/background">
<Button
android:id="@+id/btnBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="백그라운드 변경"/>
</LinearLayout>

boolean 값으로 switch를 만들어서 사용하시면 됩니다.
설정을 저장하고 싶으시다면, preference를 검색해 보세요.
아니면 http://blog.naver.com/ijoos?Redirect=Log&logNo=60134077256 이곳을 한번 보세요.