android - Null Pointer error when trying to utilize a class with AlertDialog.Builder -
trying inflate alertdialog.builder
. i'm trying date wheel (yuri kanivets' wheel) appear inside of dialog. since exact code need exists inside 1 of classes, i'm trying instantiate new instance of dateactivity
class (which i've imported project), , add dialog. unfortunately, can't seem connect dateactivity
object dialog. thought 1 of arguments inflate view, crashes. here's code:
edit: clarify, in code follows there no errors. problem mentioned there no usage, , therefore no connection, of dateactivity
variable alertdialog.builder
. i've tried using variable (datewheelselector) argument builderview , builder variable instantiations, both of these crash. need figure out how connect these since right dialog empty.
private void setstartdate() { //somehow need use variable, 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 title of dialog programatically */ textview title = (textview) builderview.findviewbyid(r.id.date_title); title.settext("choose start date"); alert.show(); }
thanks suggestions.
you cannot add activity dialog. can either define activity dialog (see android activity dialog) or can refactor dateactivity dialogfragment (see http://developer.android.com/reference/android/app/dialogfragment.html) can used fragment or dialog.
Comments
Post a Comment