I'm inflating an xml resource ant set it as the view of an AlertDialoge
. the xml contains a SeekBar
and I want to define SeekBar.onSeekBarChangeListener
for that. I tried to implement it in the onCreate()
method of the activity in which the AlertDialoge
is going to be showed, but the app gets force closed. where to implement the listener ?
Without seeing your code it's quite difficult. But here's a little hint.
You should have some code like this, where you inflate your dialog's content view:
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.myAlertDialog, (ViewGroup) activity.findViewById(R.id.layout_root));
Use your view to get your SeekBar instance and assign your listener:
SeekBar seekBar = (SeekBar) layout.findViewById(R.id.mySeekBar);
seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {...});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments