I am working on a listView which populates data from a web service, I am getting complete as per required results from webservice in json, but when I am setting it in adapter in listview, I got duplicate rows only, I also have checked my arraylist which is perfect.
public class ListingAdapter extends BaseAdapter { private Activity mContext; ArrayList<Business> busList; public ListingAdapter(Activity c, ArrayList<Business> busList) { mContext = c; this.busList = busList; } @Override public int getCount() { // TODO Auto-generated method stub return busList.size(); } @Override public Object getItem(int position) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int position) { // TODO Auto-generated method stub return 0; } @Override public View getView(final int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub View grid; LayoutInflater inflater = (LayoutInflater) mContext.getLayoutInflater(); if (convertView == null) { grid = new View( mContext ); grid = inflater.inflate( R.layout.raw_tab, null ); TextView tv_cat = (TextView) grid.findViewById( R.id.tv_cat ); ImageView iv_pic = (ImageView) grid.findViewById( R.id.iv_pic ); TextView tv_features = (TextView) grid.findViewById( R.id.tv_features ); TextView tv_location = (TextView) grid.findViewById( R.id.tv_location ); TextView tv_rating = (TextView) grid.findViewById( R.id.tv_rating ); RatingBar rt_bar = (RatingBar) grid.findViewById( R.id.rt_fvrt ); TextView tv_votes = (TextView) grid.findViewById( R.id.tv_votes ); ImageView iv_call = (ImageView) grid.findViewById( R.id.iv_call ); ImageView iv_share = (ImageView) grid.findViewById( R.id.iv_share ); tv_cat.setText( busList.get( position ).getBiz_name() ); tv_features.setText( busList.get( position ).getFeatures() ); tv_location.setText( busList.get( position ).getCity() ); tv_rating.setText( busList.get( position ).getAverage_rate() ); tv_votes.setText( busList.get( position ).getVotes() ); rt_bar.setRating( Float.parseFloat( busList.get( position ).getAverage_rate() ) ); if(!busList.get( position ).getImg_1().equals( "" )){ Picasso.with( mContext ) .load( busList.get( position ).getImg_1().replaceAll(" ", "%20") ) .placeholder( R.drawable.ic_no_img ) .error( R.drawable.ic_no_img ) .into( iv_pic ); } iv_call.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent( Intent.ACTION_CALL ); intent.setData( Uri.parse( "tel:" + (busList.get( position ).getMobile_1()) ) ); if (ActivityCompat.checkSelfPermission( mContext, Manifest.permission.CALL_PHONE ) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. return; } mContext.startActivity( intent ); } } ); iv_share.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent sharingIntent = new Intent( Intent.ACTION_SEND ); sharingIntent.setType( "text/html" ); sharingIntent.putExtra( android.content.Intent.EXTRA_TEXT, Html.fromHtml( "TEst From all About City." ) ); mContext.startActivity( Intent.createChooser( sharingIntent, "Share using" ) ); } } ); } else { grid = (View) convertView; } return grid; }}