Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Beginning Android Application Development
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Android Application Development
This is the forum to discuss the Wrox book Beginning Android Application Development by Wei-Meng Lee; ISBN: 978-1-1180-1711-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Android Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 30th, 2012, 07:58 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 2 Dialog Super Class Override

I am working on the Dialog example and I am getting an error I can't find anywhere else in the forums. On the OnClick that looks at the check boxes is giving me these errors:

- The method onClick(DialogInterface, int, boolean) of type new DialogInterface.OnMultiChoiceClickListener(){} must override a superclass
- implements android.content.DialogInterface.OnMultiChoiceClick Listener.onClick

Any help or suggestions would be appreciated. My code is below.

package com.example.dialog;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class DialogProject extends Activity {
CharSequence[] items = {"Google","Apple", "Microsoft" };
boolean[] itemsChecked = new boolean [items.length];

public void onCreate(Bundle savedInstanceState) {

Button btn = (Button) findViewById (R.id.btn_dialog);
btn.setOnClickListener (new View.OnClickListener() {
public void onClick(View v) {

protected Dialog onCreateDialog(int id) {
switch(id) {
case 0:
return new AlertDialog.Builder(this)
.setTitle("This is a dialog with some Simple Text")
DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int whichButton)
Toast.makeText(getBaseContext(), "Ok Clicked!", Toast.LENGTH_SHORT).show();
.setNegativeButton("Cancel", new
public void onClick(DialogInterface dialog,int whichButton)
Toast.makeText(getBaseContext(),"Cancel clicked",Toast.LENGTH_SHORT).show();
.setMultiChoiceItems(items, itemsChecked,new DialogInterface.OnMultiChoiceClickListener() {

public void onClick(DialogInterface dialog, int which, boolean isChecked){
Toast.makeText(getBaseContext(),items[which] + (isChecked ? " checked": " unchecked"),
return null;
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 2 -- To Do List -- when to use super.onCreate(icicle);? SteveOliverC BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 6 January 5th, 2009 10:42 PM
Invoke Events that were declated in a super class Aaron Edwards ASP.NET 2.0 Professional 1 January 2nd, 2008 03:59 PM
Capturing toolbar events inside a dialog class pazzuzu Visual C++ 0 October 13th, 2004 01:35 AM
Page_Load override with base page class nebrown1 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 August 31st, 2003 04:45 AM
Dialog Class pic_az Java GUI 4 June 5th, 2003 03:34 PM

All times are GMT -4. The time now is 03:24 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.