package com.example.test01;

import android.content.ContentValues;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

String dbName = "ingre.db";
int dbVersion = 1;
private SQLiteHelper helper;
private SQLiteDatabase db;
String tag = "SQLite"; // Log의 tag 로 사용
String tableName = "Ingredient"; // DB의 table 명

EditText iName;
EditText iQty;
EditText iDate;
Button iSave;

TextView result = (TextView) findViewById(R.id.result);



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_main);

final SQLiteHelper helper= new SQLiteHelper(getApplicationContext(), dbName, null, dbVersion);


iName = (EditText)findViewById(R.id.ing_name);
iQty = (EditText)findViewById(R.id.ing_qty);
iDate = (EditText)findViewById(R.id.ing_date);
iSave = (Button)findViewById(R.id.ing_save);

iSave.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
String iname = iName.getText().toString();
int iqty = Integer.parseInt(iQty.getText().toString());
int idate = Integer.parseInt(iDate.getText().toString());

helper.insert(iname, iqty, idate);
result.setText(helper.getResult());


}
});


}


}

너무어렵다ㅜㅜㅜㅜㅠㅠㅠㅠㅠ