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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:04:17+00:00 2026-05-20T12:04:17+00:00

So I am using my main.xml as a view in my program but I

  • 0

So I am using my main.xml as a view in my program but I still need to be able to add bimaps/drawables to the screen through programming. Is there any way to do that?

 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
 }

That is kinda what my onCreate looks like (but with a lot of code for the purpose of the app).

Is there anyway to maybe add a View or Canvas ONTOP of my current view?

I am new to bitmaps and drawables for android so sorry if this is commonly known, but I can’t find a decent answer anywhere 😛

Thanks,
Brandon

  • 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-20T12:04:18+00:00Added an answer on May 20, 2026 at 12:04 pm

    Create a Id to a framelayout in the xml (or another layout where you want to put the view)
    Maybe you can have your onCreate() something like this:

    public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
    
       //Init the framelayout from xml by id
       FrameLayout myFrameLayout = (FrameLayout) findViewById(R.id.myFrameLayout);
    
       //Create a new ImageView
       img_icon = new ImageView(this);
       img_icon.setImageResource(R.drawable.icon);
       img_icon.setAdjustViewBounds(true);
       img_icon.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
    
       //Add the newly created ImageView
       myFrameLayout.addView(img_icon);
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How could i inflate my custom view using the main.xml file? I thought it
I wanna add server controls by using javascript. The main purpose of why I
I'm writing a Silverlight app using the MVVM pattern. I have a main view
I've been using Visual Studio as my main IDE for a while now (I
(I'm using Visual C++ 2008) I've always heard that main() is required to return
I am using JavaScript and jQuery. My main file has My.js and Ajax. My.js
Goal: Create Photomosaics programmatically using .NET and C#. Main reason I'd like to do
Is there a difference between using exit() or just return statements in main() ?
I have a DotNetNuke site where my main logo is a PNG file using
I am using getch() and my app crashes instantly. Including when doing: int main()

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.