N
N
nikita_chiru2016-06-02 10:39:34
Android
nikita_chiru, 2016-06-02 10:39:34

Why is there a repetition every 6 elements of the list?

The list only shows 6 items out of 30, repeating them 5 times
SwipeMenuListView listView = (SwipeMenuListView) findViewById(R.id.listView);
List cold = new ArrayList<>();
cold.add(new ListData("Philadelphia Classic ", 169, R.drawable.filadelfia));
cold.add(new ListData("Rainbow", 169, R.drawable.raduga));
cold.add(new ListData("Double Strike", 209, R.drawable.dvoi));
cold.add(new ListData("Chickenhot", 209, R.drawable.chikenhot));
cold.add(new ListData("Lava", 219, R.drawable.lava));
cold.add(new ListData("Philadelphia Premium", 240, R.drawable.filadpro));
cold.add(new ListData("Creamy with salmon", 169,
cold.add(new ListData("Saiman", 240, R.drawable.saiman));
cold.add(new ListData("Vegetarian",149 , R.drawable.veg));
cold.add(new ListData("Yasai Roll", 159, R.drawable.yasai));
cold.add(new ListData("California", 169, R.drawable.california));
cold.add(new ListData("Caviar Philadelphia", 189, R.drawable.vikrefill));
cold.add(new ListData("Chicken Roll", 209, R.drawable.chikenroll));
cold.add(new ListData("California cheese", 209, R.drawable.californiachis));
cold.add(new ListData("California Shrimp", 209, R.drawable.californiaskrev));
cold.add(new ListData("Alcapone", 210, R.drawable.alkap));
cold.add(new ListData("Jazz Blues", 210, R.drawable.jazbluz));
cold.add(new ListData("Chuka", 210, R.drawable.chuka));
cold.add(new ListData("Kiota", 220, R.drawable.kiota));
cold.add(new ListData("Dakota", 214, R.drawable.dakota));
cold.add(new ListData("Volcano", 219, R.drawable.vulkan));
cold.add(new ListData("Spicey Abi", 220, R.drawable.spaisiebi));
cold.add(new ListData("Vendetta", 230, R.drawable.vendeta));
cold.add(new ListData("Okinawa", 220, R.drawable.okinava));
cold.add(new ListData("Eel with mushrooms", 230, R.drawable.ugorsgribami));
cold.add(new ListData("
cold.add(new ListData("Philadelphia Royal", 240, R.drawable.fillroial));
cold.add(new ListData("Cream Cheese", 240, R.drawable.crem));
cold.add(new ListData("Green Roll", 179, R.drawable.green));
cold.add(new ListData("Bonito", 189, R.drawable.bonito));
cold.add(new ListData("Spicy Tuna", 199, R.drawable.ostristuncom));
cold.add(new ListData("Caesar maki", 209, R.drawable.cezarmakki));
final CustomArrayAdapter adapter = new CustomArrayAdapter(this, R.layout.item, cold);
listView.setAdapter(adapter);
||||||
|||||||||||||||||
|||||||||||||||||||||||||||||
public class CustomArrayAdapter extends ArrayAdapter {
ArrayList objects;
protected LayoutInflater inflater;
protected int layout;
public CustomArrayAdapter(Activity activity, int resourceId, List objects){
super(activity, resourceId, objects);
layout = resourceId;
inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ListData p=((ListData) getItem(position));
View v = inflater.inflate(R.layout.item, parent, false);
((TextView) v.findViewById(R.id.textView1)).setText(p.title);
((TextView) v.findViewById(R.id.textView2)).setText(p.price+"rub");
((ImageView) v.findViewById(R.id.imageView1)).setImageResource(p.image);
returnv;
}
}
||||||||||||||||||||||
||||||||||||||||||||||||
||||||||||||||||||||||||

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question