package com.example.kechengbiao;


import com.example.fragment.FragmentController;
import android.app.Activity;
import android.os.Bundle;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;

public class MainActivity extends Activity {

	private RadioGroup rg_kcb;
	private FragmentController controller;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		initView();
		controller = FragmentController.getInstance(this, R.id.id_content);
		controller.showFragment(0);
		
		initEvent();
	}

	private void initEvent() {
		rg_kcb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
			
			public void onCheckedChanged(RadioGroup group, int checkedId) {
				switch (checkedId) {
				case R.id.rb_kcb:
					controller.showFragment(0);
					break;
                case R.id.rb_wo:
                	controller.showFragment(1);
					break;
				default:
					break;
				}
			}
		});
		
	}
	private void initView() {
		rg_kcb = (RadioGroup) findViewById(R.id.rg_kcb);
		
	}
	
	
}
