다른 페이지는 다 잘 넘어가는데
여기에서 문제가 발생해요
뭐가 잘못된지 모르겟어요 도와주세요
그리고 체크박스에 체크한것을 기억하는 것을 하려고하는데
에러가 나네요 ㅜㅜ
그래서 주석문으로 달아놨어요,,
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.provider.BaseColumns;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.SimpleCursorAdapter;
public class Table extends ListActivity implements OnClickListener{
private NotesDbAdapter dbAdapter;
private SimpleCursorAdapter mAdapter;
private SQLiteDatabase mDb;
private Button btn, btn1;
// private CheckBox check1;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.table);
// SharedPreferences pref = getSharedPreferences("pref", Activity.MODE_PRIVATE);
btn = (Button)findViewById(R.id.back1);
btn.setOnClickListener(this);
btn1 = (Button)findViewById(R.id.socket);
btn1.setOnClickListener(this);
// check1 = (CheckBox)findViewById(R.id.CheckBox01);
// Boolean chk1 = pref.getBoolean("check1", false);
// check1.setChecked(chk1);
}
@Override
protected void onResume() {
super.onResume();
//데이터베이스를 오픈함
dbAdapter = new NotesDbAdapter(this);
dbAdapter.open();
//모든 데이터의 커서를 얻어옴
Cursor c = dbAdapter.fetchAllNotes();
// Base 클래스에게 Cursor의 라이프사이클을 관리시킴
startManagingCursor(c);
//리스트뷰에 데이터베이스의 저장된 데이터를 연결
String[] from = new String[] {BaseColumns._ID,
NotesDbAdapter.KEY_TITLE,
NotesDbAdapter.KEY_BODY };
int[] to = new int[] { R.id._id, R.id.title_text, R.id.body_text };
mAdapter = new SimpleCursorAdapter(
this, R.layout.table_row, c, from, to);
setListAdapter(mAdapter);
}
@Override
protected void onPause() {
super.onPause();
mDb.close();
}
/*
public void onStop(){
super.onStop();
SharedPreferences pref = getSharedPreferences("pref", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = pref.edit();
editor.putBoolean("check1", check1.isChecked());
editor.commit();
}
*/
public void onClick(View v) {
if(v == btn){
Intent intent1 = new Intent(this,Select.class);
startActivity(intent1);
}
else if(v == btn1){
Intent intent2 = new Intent(this,AbcActivity.class);
startActivity(intent2);
}
}
}