Yep builder.setView(View v); here is how you can use it.
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.yourLayoutId, (ViewGroup) findViewById(R.id.yourLayoutRoot)); AlertDialog.Builder builder = new AlertDialog.Builder(this) .setView(layout); AlertDialog alertDialog = builder.create(); alertDialog.show(); SeekBar sb = (SeekBar)layout.findViewById(R.id.yourSeekBar); sb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser){
Edit: added progressListener for sample code. Note that you cannot get a link to your SeekBar until after , you call alertDialog.show (), if the SeekBar is not displayed, findViewById () returns null. Also note that you should use layout.findViewById(); , because the SeekBar is a child of the RelativeLayout to which the "layout" refers.
Foamyguy
source share