java - android 4 onCreateDialog return type incompatible when overriding -


the code below won't compile. understand when doing override, replacement class must match signature of original class exactly, think i'm following example android documentation carefully.

error messages:

overrides android.app.activity.oncreatedialog return type incompatible activity.oncreatedialog(int) 

oncreatedialog() method:

@override protected dialog oncreatedialog(int id) {     switch (id) {     case 0:         alertdialog.builder builder = new alertdialog.builder(this);          builder.seticon(r.drawable.ic_launcher)             .settitle("this dialog stupid message...")              //more code here setting additional properties             );     return builder.create();     } } 

you need default return block in switch or return after switch. can return null in cases.


Comments