I created ListViewwith a custom array adapter MyObject. One instance MyObjectcontains a Stringand a boolean. When I render ListView, all of my objects are in bold, and if you click on one of these elements, you will start a new one Activity. What I want to do is that every time you click back and go back to that ListView, you render the element that you clicked not in bold. This is my custom ArrayAdapter:
public class MyAdapter extends ArrayAdapter<MyObject> {
private final Context context;
private final ArrayList<MyObject> values;
public MyAdapter(Context context, ArrayList<MyObject> values) {
super(context, R.layout.my_item, values);
this.context = context;
this.values = values;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if(convertView == null){
convertView = inflater.inflate(R.layout.my_item, parent, false);
}
TextView textView = (TextView) convertView.findViewById(R.id.itemName);
textView.setText(values.get(position).getMyObjectName());
if(values.get(position).isSetted()){
textView.setTypeface(null, 0);
}
return convertView;
}
}
In mine, ActivityI put:
@Override
protected void onResume() {
super.onResume();
adapter.notifyDataSetChanged();
}
. : , , , ! ! ?
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
String item = objList.get(position).getMyObjectName();
objList.get(position).setSetted(true);
to_ans.putExtra("ItemName", item);
startActivity(to_ans);
}
boolean false.