java - Dialog context issue - Android -


i have created dialog box using custom layout:

    dialog = new dialog(fetchmenu.this, r.style.customdialogtheme);     dialog.setcontentview(r.layout.custom_dialog_iab);     dialog.show(); 

i trying edit textbox within 'layout.custom_dialog_iab' example:

textview text = (textview) findviewbyid(r.id.all_topics_unlock_button); text.settext("purchased"); 

my question: how right context able edit textboxes?

p.s. have tried 'dialog.getcontext()' still keep throwing null pointers?

you need use:

textview text = (textview) dialog.findviewbyid(r.id.all_topics_unlock_button); 

note dialog. in front of findviewbyid

regular findviewbyid() search activity layout rather dialog layout.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -