package com.example.checkregister;

import android.app.ListActivity;
import android.content.Context;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.SimpleCursorAdapter;

public class CheckMonthlyReportActivity extends ListActivity {
  private SimpleCursorAdapter sca;
  private Cursor cursor;
  private CheckRegisterDBAdapter dba;
  private Context context;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = (Context) this;
    dba = new CheckRegisterDBAdapter(this);
    cursor = dba.getAmountByMonthList("");
    startManagingCursor(cursor);

    String[] columns = new String[] { "month", "checks_written",
        "month_amount", };
    int[] views = new int[] { R.id.monthView, R.id.checksWrittenView,
        R.id.monthAmountView, };
    sca = new SimpleCursorAdapter(context, R.layout.monthly_report_item,
        cursor, columns, views);
    setListAdapter(sca);
  }
  
  @Override
  protected void onDestroy() {
    super.onDestroy();
    dba.close();
  }

}
