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

I have a more conceptual question in Rails... or Ruby for that matter: Is
Say I have the following class: @interface Frob : NSObject { NSData *data; }
I have a conceptual problem to do with PHP classes and error handling.. Below
I have developed some extension methods for objects, which I don't want to be
Just getting started on iPhone dev today and have run through Apple's HelloWorld tutorial:
Hello I have a pump class that requires using a member variable that is
I have a service called myService.svc. This service is exposed using a webHttpBinding binding.
Looking for some ideas/pattern to solve a design problem for a system I will
Whenever I tried to search about differences between classes and structs in C# or
I'm kind of stuck working out where I'm going wrong with the below entity

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.