private void addFavor(int id) { Traveler p = Travelers.get(id); Cursor cursor = DH.matchData( p.getName(), p.getCategory(), p.getAddress(), p.getTelephone(), p.getLongitude(), p.getLatitude(), p.getContent()); int rows_num = cursor.getCount(); if (rows_num == 1) { Toast.makeText(this, "您已經新增過了", Toast.LENGTH_SHORT).show(); } else { DH.insert( p.getName(), p.getCategory(), p.getAddress(), p.getTelephone(), p.getLongitude(), p.getLatitude(), p.getContent()); Toast.makeText(this, "新增至我的最愛", Toast.LENGTH_SHORT).show(); } }