Skip to main content

Posts

Showing posts with the label seekbar

Stop Android SeekBar resetting

I have a ListView in which each item has a SeekBar. When I update the progress of the Seekbar this is written to a database so it can be reloaded when the application is used again. Unfortunately if the ListView is scrolled up or down so that any of the items disappear from the visible screen, when they are redrawn they are drawn with the old value. How do I get the activity to "refresh" when the SeekBar is updated so the values behind the ListView are in sync with the database, this should stop the SeekBar being redrawn with stale data. @Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; try { if (view == null) { LayoutInflater vi = (LayoutInflater) mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = vi.inflate(R.layout.task_list_item, null); } final Task t = mList.get(position); if (t != null) { /* assign layout elements */ final SeekBar seekBar = (SeekBar