I have a database for my application.It has 5 different columns. Fifth column name is color.This column has 2 different type of colors.(blue and orange ) Other columns are only data and every data has a color.I want to eliminate my all data to according to these colors.So that I have 3 activities that has custom listview. First one has 2 type colors.There is no problem.But when I passing to second activity(only orange) get exception. İnteresting thing that ; İf first activity has only orange type color.It works correctly.When first activity has blue type data, gives me exception. I want to elimination only blue type and send to second activity(only orange type datas).How can I do that ?
while (data.moveToNext()){
kelimeler_array.add(data.getString(1));
akli_göz_array.add(data.getString(2));
kelimelerin_anlamı_array.add(data.getString(3));
boya_array.add(data.getString(4)); //color array = boya_array
for (int i = 0 ; i<boya_array.size(); i++){
while (boya_array.get(i).equals("#419FEE")){
boya_array.remove(i); //color array = boya_array
kelimeler_array.remove(i);
akli_göz_array.remove(i);
kelimelerin_anlamı_array.remove(i);
}
}
}
Here is my custom listview :
private class Kelimelerim_custom_layout_2_item extends BaseAdapter {
@Override
public int getCount() {
return kelimeler_array.size();
}
@Override
public Object getItem(int position) {
return kelimeler_array.size();
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = getLayoutInflater().inflate(R.layout.activity_atolyem_custom_layout_2_item,null);
TextView kelime = (TextView) convertView.findViewById(R.id.kelime);
kelime.setText(kelimeler_array.get(position));
TextView kelimelerin_anlamı = (TextView) convertView.findViewById(R.id.anlam);
kelimelerin_anlamı.setText(kelimelerin_anlamı_array.get(position));
TextView akli_göz = (TextView) convertView.findViewById(R.id.ses_benzerliği_text);
akli_göz.setText(akli_göz_array.get(position));
convertView.setBackgroundColor(Color.parseColor(boya_array.get(position)));
return convertView;
}
}