Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3781660
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:58:22+00:00 2026-05-19T10:58:22+00:00

This question is about the concept of what I am attempting to code. I

  • 0

This question is about the concept of what I am attempting to code.

I Have an Activity
“public class Board extends Activity {”
which has “setContentView(myBoard)” where myBoard is an instance of
“class NewBoard extends View implements OnTouchListener{”
NewBoard draws graphics with onDraw and also draws graphical buttons.
A click on a button called “Solve” makes a call to another class
“public class SKO {” which has no visual componants and does a calcuation, the results of which are redrawn by the graphic view.

This all works well.

I now want to call a Dialog from more graphically drawn buttons on the NewBoard View.

In the “top” class – Board, I have suitable code in
“protected Dialog onCreateDialog(int id) {”
I know this code is good because if I add a showDialog(int),(an Alertdialog with a cancel button) to the onCreate of Board,then on running the class Board, the dialog comes up, and when cancelled, my graphics are working underneath.

My problem is ****

that I can’t find a way to call the showDialog(int) within Board from my graphics View (NewBoard).

I have tried adding the “protected Dialog onCreateDialog(int id) {” to my graphics View (NewBoard) but I believe it can only be added to an activity.
I would very much appreciate some advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T10:58:23+00:00Added an answer on May 19, 2026 at 10:58 am

    I would suggest that you define a Listener interface like NewBoardListener (not a great name, but good enough for an example). Your Board class can register with your NewBoard view as a NewBoardListener. Let’s assume the button event in your NewBoard view has something to do with “View Status” then your NewBoardListener interface can define a method called something like onViewStatus(). When the user taps the button on the NewBoard view, you make a callback to your newBoardListener.onViewStatus(). Then in your Board class which implements the NewBoardListener interface, in your onViewStatus method, you call showDialog(int).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question about Timers for windows services got me thinking: Say I have (and
I have seen this question about deploying to WebSphere using the WAS ant tasks.
I have a question about this question . I posted a reply there but
I have a question about Twilio's call forwarding concept. I want to create an
I came across this question about callbacks in Java. Hers is the running code
Followed this question about delayed_job and monit Its working on my development machine. But
This question is a follow up to my previous question about getting the HTML
I was reading this question about how to parse URLs out of web pages
I just came across this question about initializing local variables. Many of the answers
Follow up to this question about GNU make : I've got a directory, flac

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.