private Listing makeListing(int number){
  int mod=number % 3;
  int resource;
  if (mod == 0) {
    resource=R.drawable.house1;
  }
 else   if (mod == 1) {
    resource=R.drawable.house2;
  }
 else {
    resource=R.drawable.house3;
  }
  return new Listing(String.format("Generic listing #%d",number),"House for rent","1,000 sq. ft, 2/2 with 2-car garage!","$2,800/mo",resource);
}

private Listing makeListing ( int number ) { int mod = number % 3 ; int resource ; if ( mod == 0 ) { resource = R . drawable . house1 ; } else if ( mod == 1 ) { resource = R . drawable . house2 ; } else { resource = R . drawable . house3 ; } return new Listing ( String . format ( "Generic listing #%d" , number ) , "House for rent" , "1,000 sq. ft, 2/2 with 2-car garage!" , "$2,800/mo" , resource ) ; }
generates a sample listing .
