I would like to use a dialog with a seekbar in my application. But I don\'t really know how to do it because I lack experience with android.
So, when you press a but
I hope this will help you. Try this Code...
final AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Alert Box");
alert.setMessage("Edit Text");
LinearLayout linear=new LinearLayout(this);
linear.setOrientation(1);
TextView text=new TextView(this);
text.setText("Hello Android");
text.setPadding(10, 10, 10, 10);
SeekBar seek=new SeekBar(this);
linear.addView(seek);
linear.addView(text);
alert.setView(linear);
alert.setPositiveButton("Ok",new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog,int id)
{
Toast.makeText(getApplicationContext(), "OK Pressed",Toast.LENGTH_LONG).show();
finish();
}
});
alert.setNegativeButton("Cancel",new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog,int id)
{
Toast.makeText(getApplicationContext(), "Cancel Pressed",Toast.LENGTH_LONG).show();
finish();
}
});
alert.show();