package com.android.dbs;
import android.app.Activity;
//import android.content.DialogInterface;
//import android.content.DialogInterface.OnClickListener;
//import android.view.View;
//import android.view.View.OnClickListener;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
//import android.widget.ListAdapter;
public class DanceDemoActivity extends Activity {
Button btn_music;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init();
setContentView(R.layout.main);
}
public View.OnClickListener musicOnClickListener = new View.OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setClass(DanceDemoActivity.this, MusicList.class);
startActivity(intent);
}
};
public void init(){
btn_music = (Button) this.findViewById(R.id.btn_game_music);
btn_music.setOnClickListener(musicOnClickListener);
}
}
------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/main_1"
android:orientation="vertical" >
<Button
android:id="@+id/btn_game_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="22dp"
android:layout_marginTop="43dp"
android:text="@string/game_start" />
<Button
android:id="@+id/btn_game_music"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btn_game_start"
android:layout_below="@+id/btn_game_start"
android:text="@string/game_music" />
<Button
android:id="@+id/btn_game_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btn_game_music"
android:layout_below="@+id/btn_game_music"
android:text="@string/game_background" />
<Button
android:id="@+id/btn_game_about"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btn_game_background"
android:layout_alignRight="@+id/btn_game_background"
android:layout_below="@+id/btn_game_background"