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 3337948
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:18:54+00:00 2026-05-18T00:18:54+00:00

I have a conceptual question to ask: I created a custom dialog (extends Dialog)

  • 0

I have a conceptual question to ask:

I created a custom dialog (extends Dialog) and I want to draw a chart (dynamic data, not static) in the top third of the dialog.

What’s the best (only?) way to approach this?

A) Get a canvas to the dialog and draw to it? Seems like I need access to the dialog’s draw, yes, or can I do this outside of the draw?

B) Subclass a view within the dialog layout (e.g. LinearLayout) and override it’s draw and draw the chart?

C) Other? I’ve read that one approach would be to draw to a bitmap and then blt (or equivalent) to the canvas. This sounds closer to what I want to do, as once I create the chart, I have no need to alter it (no direct user interaction).

I haven’t yet found any good sample code that deals with custom drawing in a dialog, so if I’m missing something, an example would be great.

Thanks much,

Rich

  • 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-18T00:18:54+00:00Added an answer on May 18, 2026 at 12:18 am

    Solved.

    My solution was a hybrid of B/C above. Since I needed access to the view’s draw() method, I created my own subclass of an ImageView (e.g., MyView).

    From within the draw(), I can get the dynamic size of the ImageView as it appears in the dialog. Given the size, I can now perform draws scaled to the custom ImageView size within the dialog.

    I had to remember to use the proper custom view XML syntax in the dialog layout (e.g. “com.avaliant.dialogtest.MyView” to replace “ImageView”). And, of course, in my dialog class, I had to set to view to the proper view class:

    MyView test = (MyView)dialogView.findViewById(R.id.test);
    

    Quite easy once I understood WHY I had to do what I had to do :).

    Rich

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

Sidebar

Related Questions

A conceptual question: I have data stored hierarchically via Core Data SQLite for an
I have this conceptual question about ajax that I'm not sure if I understand.
I have a conceptual question... I am making an Intranet application (Web platform) for
i have a very conceptual question regarding jquery. i have this fiddle http://jsfiddle.net/zvCrN/ What
More of a design/conceptual question. At work the decision was made to have our
This is a conceptual question involving Hadoop/HDFS. Lets say you have a file containing
This is more of a conceptual question than anything. I have a base class
I have an interesting situation here this time. This more of a conceptual question,
I have a conceptual question. I am wondering how companies such as Alexa Internet
I have a MultiThreading issue and conceptual question using Visual Basic (but it applies

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.