Trying to inflate an AlertDialog.Builder
. I'm trying to get the date wheel (Yuri Kanivets' wheel) to appear inside of my dialog. Since the exact code that I need exists inside one of his classes, I'm just trying to instantiate a new instance of his DateActivity
class (which I've imported into my project), and then add that to my dialog. Unfortunately, I can't seem to connect my DateActivity
object with my dialog. I thought that it would be one of the arguments where I inflate the view, but that crashes. Here's my code:
EDIT: To clarify, in the code that follows there are no errors. The problem as I mentioned is that there is no usage, and therefore no connection, of my DateActivity
variable with the AlertDialog.Builder
. I've tried using that variable (dateWheelSelector) as an argument to builderView and also to the builder variable instantiations, but both of these crash. I need to figure out how to connect these since right now my dialog is empty.
private void setStartDate() {
//somehow I need to use this variable, but where???
DateActivity dateWheelSelector = new DateActivity();
LayoutInflater inflater = LayoutInflater.from(this);
View builderView = inflater.inflate(R.layout.wheel_date_layout, null);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(builderView);
alert = builder.create();
/* Set the title of this dialog programatically */
TextView title = (TextView) builderView.findViewById(R.id.date_title);
title.setText("Choose Start Date");
alert.show();
}
Thanks for any suggestions.