i got the answer i should add an else statement to if here is my code:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
db.open();
View row=convertView;
if(row==null){
LayoutInflater inflater=(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row=inflater.inflate(R.layout.custom_list_main, parent, false);
}
//final String o=objects.get(position);
//if(o!=null){
TextView name=(TextView) row.findViewById(R.id.name);
String nameString=mAdapter.getItem(position);
name.setText(nameString);
// ImageView photo= (ImageView) row.findViewById(R.id.photo);
TextView ownerSign=(TextView) row.findViewById(R.id.owner_text);
//String value =getItem(position);
if(checkOwner()!=null && getItem(position).equals(checkOwner())){
ownerSign.setText(getResources().getString(R.string.owner));
}
else{
ownerSign.setText(getResources().getString(R.string.nothing));
}
//}
db.close();
return row;
}
public String checkOwner(){
Cursor c=db.getAllPerson();
if(c.moveToFirst()){
do{
if(c.getInt(c.getColumnIndex(Constants.OWNER))>0){
return c.getString(c.getColumnIndex(Constants.PERSON_NAME));
}
}while(c.moveToNext());
}
return null;
}