I'm developing simple shopping list application for android.
As I'm able to strikethrough & unstrike the items in the list view. But after opening back the closed application I'm unable to get updated(saved) strikethroughs for the items, all the items are cleared from strikethrough's
вот часть кода, который я реализовал для onItemClickListener
if (checkedVals[position]==true)
{
TextView text1 = (TextView)arg1.findViewById(R.id.customitemsrowTV);
text1.setPaintFlags(text1.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
text1.setTextColor(0xff000000);
String strikethrough1 = "false";
dbAdapterItems.updateItemsStrikethroughRecord(rowitemsid, strikethrough1);
//checkedVals[position] = false;
}
else
{
TextView text1 = (TextView)arg1.findViewById(R.id.customitemsrowTV);
text1.setPaintFlags(text1.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
text1.setTextColor(0xff888888);
String strikethrough1 = "true";
dbAdapterItems.updateItemsStrikethroughRecord(rowitemsid, strikethrough1);
//checkedVals[position] = true;
}
вот код, заполненный для списка:
TextView itemsRowTv = (TextView)convertView.findViewById(R.id.customitemsrowTV);
TextView quantityRowTv = (TextView)convertView.findViewById(R.id.customquantityrowTV);
TextView priceRowTv = (TextView)convertView.findViewById(R.id.custompricerowTV);
cItems.moveToPosition(position);
String itemName = cItems.getString(1);
checkedVals[position] = Boolean.parseBoolean(cItems.getString(3));
String itemQuantity = cItems.getString(4);
String itemPrice = cItems.getString(5);
if (checkedVals[position]==true)
{
itemsRowTv.setText(itemName);
//TextView text1 = (TextView)arg1.findViewById(R.id.customitemsrowTV);
//itemsRowTv.setPaintFlags(itemsRowTv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
//itemsRowTv.setTextColor(0xff000000);
//checkedVals[position] = false;
}
else
{
//TextView text1 = (TextView)arg1.findViewById(R.id.customitemsrowTV);
itemsRowTv.setText(itemName);
itemsRowTv.setPaintFlags(itemsRowTv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
itemsRowTv.setTextColor(0xff888888);
//checkedVals[position] = true;
}
Просьба предложить решение для моей проблемы, когда все идет не так ... Спасибо.