package com.example.eg17_1;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {
	
	private String mPath;
	private TextView textView;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		textView = (TextView) findViewById(R.id.label);
		
		Button button1 = (Button)findViewById(R.id.button1);
		button1.setOnClickListener(new Button.OnClickListener(){
			public void onClick(View v) {
				// TODO Auto-generated method stub
				ToDoDBAdapter dbAdapter = new ToDoDBAdapter(MainActivity.this);
				
				mPath = dbAdapter.open();
				textView.setText("创建数据库成功, 数据库路径为: " + mPath);
				
				dbAdapter.close();
			}  
		});
	}

}
