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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -