I do LayoutInflator in a TableRow. (FYI)
In this I do the following:
((SeekBar)tr1.findViewById(R.id.seekBarMe)).setOnSeekBarChangeListener(this);
((SeekBar)tr1.findViewById(R.id.seekBarMe)).setTag(i);
((SeekBar)tr1.findViewById(R.id.seekBarMe)).setProgress(0);
These things work and my app runs fine. However, when I do the following, it seems to crash.
((SeekBar)tr1.findViewById(R.id.seekBarMe)).incrementProgressBy(1);
((SeekBar)tr1.findViewById(R.id.seekBarMe)).setMax(10);
Then,
ArrayList<View> myViews = new ArrayList<View>();
myViews.add(tr1);
If anyone knows what the problem is, I would really appreciate your help. Thanks,
It turns out that the SeekBar onProgressChanged() gets invoked before you add anything to myViews ArrayList.
So, it gives an IndexOutOfBounds exception because you access myViews in the onProgressChanged().
Now you shall work on the onProgressChanged() code so that it doesn't access myViews until the size is greater than 0.
:)