안드로이드 개발 질문/답변
(글 수 45,052)
디비에서 정보를 뽑아 내는데
AdapterStomach=new productAdapter(mListView.getContext(), R.layout.page_list_listview, cursor,
new String[]{"m_name", "tag_line", "detail_img"},new int[]{R.id.toptext, R.id.bottomtext});
Cursor c = (Cursor)AdapterStomach.getItem(position);
String note = c.getString(c.getColumnIndex("detail_img"));
Toast.makeText(getApplicationContext(), note, Toast.LENGTH_LONG).show();
이렇게 토스트로 찍어보면
rl56gpgbp_img_detail 이라고 나오는데
문자열 비교를 해보면
String sr1 = new String(note);
String sr2 = new String(rl56gpgbp_img_detail);
if(sr1.equals(sr2))
{
Toast.makeText(getApplicationContext(), "same", Toast.LENGTH_LONG).show();
}
이렇게 해보면 토스트가 뜨질 않네요.
디비 열어봐도 rl56gpgbp_img_detail 이렇게 잘 들어가있는데
왜 정작 문자열 비교해봤을 때 다를까요
아... 정말 미치겠어요ㅠㅠ
뭐가 문제일까요?




String sr2 = new String("rl56gpgbp_img_detail");
이 문제 아닐까요?