예를들어

제목 : String

내용 : String입니다.    이런식으로 하려고 하는데요

 

제목의 String에 해당하는것은 DB1에서 뽑아오고

내용의 String입니다 에 해당하는것은 DB2에서 뽑아온다음에

 

두 DB에서 Select 한 것을 cursor도 두개 놓고 각각 moveToLast()로 한다음에.. getString(0) 끼리 비교해서 맞으면 내용뿌려주는거 하는데

왜 자꾸 가비지값이 나오는지 모르겠네요ㅠㅠ 도와주십시오.

 

public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.result);

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

  Go_recent dManager = new Go_recent(this, "Search.db", null, 1);
  db = dManager.getReadableDatabase();

  Dictionary dic = new Dictionary(this, "Search_mean.db", null, 1);
  db2 = dic.getReadableDatabase();

  Cursor cursor = db.rawQuery("SELECT * FROM recent_search", null);
  Cursor cursor2 = db2.rawQuery("SELECT * FROM test", null);

  if (cursor.moveToLast()) {
   selected_word.setText(cursor.getString(0));
   if (cursor2.moveToLast()) {
    if (cursor.getString(0) == cursor2.getString(0)) {
     result.setText(cursor2.getString(1));
    } else {
     result.setText("Error!!");
    }
   }
  }

  db.close();
 }

 

selected_word.setText(cursor.getString(0) 이것은 잘 적용이 되는데요,

밑에 resul.setText(cursor2.getString(1) 이건 왜 안되고 자꾸Error 만 나오는지 도와주세요ㅠㅠ