@Override
public void onClick(View v) {
// TODO Auto-generated method stub
int getId = v.getId();
switch (getId) {
case R.id.addbtn:
intent = new Intent(ListviewMain.this, EditClass.class);
startActivityForResult(intent, 0); // 에디트클래스의 엑티비티에서 다시
// 돌아옴으로 포리조트함수사용
break;
case R.id.Searchbtn:
// Intent intent = new Intent(ListviewMain.this, ServiceApp.class);
SearchAdd = searchinput.getText().toString();
Log.i("여기다", "여 " + SearchAdd);
populateListView(SearchAdd);
// EditText edit = (EditText)findViewById(R.id.edit);
// TextView search;
// EditText searchinput;
// static String SearchAdd;
break;
default:
break;
}
}
public void populateListView(String s){
DBHelper dbhelper = new DBHelper(this);
db = dbhelper.getWritableDatabase();
try {
Cursor c=db.rawQuery( "SELECT * FROM test WHERE contents='SearchAdd'", null);
Log.i("?","d"+c);
Log.i("d","ddd"+c.getCount() +","+ c.getCount());
if(c.getCount()!=0 || c.getColumnCount() != 0)
{
if(c.moveToFirst())
{
Log.i("d","ddd");
do {
String title=c.getString(c.getColumnIndex("TITLE"));
Log.i("d","d"+title);
String contents=c.getString(c.getColumnIndex("CONTENTS"));
arrayList.add("title :"+TITLE+"\n"+"contents :"+CONTENTS+"\n");
} while (c.moveToNext());
}
}
06-07 15:35:18.199: E/SpannableStringBuilder(21092): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
06-07 15:35:18.199: E/SpannableStringBuilder(21092): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
06-07 15:35:20.179: I/여기다(21092): 여 소
06-07 15:35:20.179: I/System.out(21092): opened database [test.db].
06-07 15:35:20.179: I/?(21092): dandroid.database.sqlite.SQLiteCursor@4312f7b8
06-07 15:35:20.179: I/d(21092): ddd0,0
private static final String Q_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS "
+ TB_NAME + " (_id INTEGER PRIMARY KEY AUTOINCREMENT " + ","
+ "title TEXT " + "," + "contents TEXT" + ");";
에러는 안뜨는데 ddd0,0이 뜨는걸 보면 비교문에 대한 오류 같습니다. ㅠㅠ
content를 직접 쓰는게 아니라 받아오는 문장인데 그래서 그런걸까요?? ㅜㅜ