package xiedong.systemdairy;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class newMenu extends Activity{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.menu);
		setTitle("向乔哥致敬!");
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		
		// TODO Auto-generated method stub
		menu.add(0, 1, 0, "创建日记");
		menu.add(0, 2, 0, "查看日记");
		menu.add(0, 3, 0, "删除日记");
		menu.add(0, 4, 0, "分享日记");
		return super.onCreateOptionsMenu(menu);
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		Intent intent;
		switch (item.getItemId()) {
		case 1:
			// 添加日记
			intent = new Intent(this, createDairy.class);
			startActivity(intent);
			break;

		case 2:
			// 查看日记
			intent= new Intent(this, lookDairy.class);
			startActivity(intent);
			break;
		case 3:
			intent= new Intent(this, lookDairy.class);
			startActivity(intent);
			break;
		case 4:
			intent= new Intent(this, Share.class);
			startActivity(intent);
			break;
		}
		

		return super.onOptionsItemSelected(item);
	}
	@Override
	protected void onDestroy() {
		finish();
		// TODO Auto-generated method stub
		super.onDestroy();
	}
}