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

  • Home
  • SEARCH
  • 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 9173683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:37:37+00:00 2026-06-17T16:37:37+00:00

I am now making a painting apps, and would like to ask how to

  • 0

I am now making a painting apps, and would like to ask how to load a picture and set to a Bitmap?

I have set the coding as follows, and links Class A and Class DrawView.

Question:

The code reports error “The method setImageBitmap(Bitmap) is undefined for the type Bitmap” in DrawView Class for the line

bitmap.setImageBitmap(BitmapFactory.decodeFile(picturePath));

, I do not know how to load a picture to Bitmap.

in Class A:

private DrawView drawView;
...
...

public void go_load_pic() 
{       
    Intent i = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);                
    startActivityForResult(i, RESULT_LOAD_IMAGE);   
}   

protected void onActivityResult(int requestCode, int resultCode, Intent data) 
{
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) 
    {
        Uri selectedImage = data.getData();
        String[] filePathColumn = { MediaStore.Images.Media.DATA };

        Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
        cursor.moveToFirst();

        int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
        String picturePath = cursor.getString(columnIndex);
        cursor.close();

        drawView.load_pic(picturePath);     
    }   
}   

in Class DrawView:

public class DrawView extends View  // the main screen that is painted
{
   // used to determine whether user moved a finger enough to draw again   
   private static final float TOUCH_TOLERANCE = 10;

   private Bitmap bitmap; // drawing area for display or saving
   private Canvas bitmapCanvas; // used to draw on bitmap
   private Paint paintScreen; // use to draw bitmap onto screen
   private Paint paintLine; // used to draw lines onto bitmap
   private HashMap<Integer, Path> pathMap; // current Paths being drawn
   private HashMap<Integer, Point> previousPointMap; // current Points
   ...

public void load_pic(String picturePath) // load a picture from gallery
   {
      bitmap.setImageBitmap(BitmapFactory.decodeFile(picturePath)); //ERROR LINE
      invalidate(); // refresh the screen
   }
  • 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-06-17T16:37:38+00:00Added an answer on June 17, 2026 at 4:37 pm

    You’re calling a method that doesn’t exist on the Bitmap class. That method is found on framework widgets like ImageView and ImageButton. BitmapFactory returns a Bitmap already, so just assign the instance.

    bitmap = BitmapFactory.decodeFile(picturePath);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data in db,now i m making them to display in the
i'm making window component on Flash Professional CS4 and now i have 1 problem.
I'm making a website using JSP and servlets and I have to now break
I would like to have the EntityFramework4 model (.edmx and .context.tt) in a Class
I'm making something like an augmented reality app, in which I have an OpenGL
I have a list of items with some details that I would like to
I'm now making unit-tests for already existing code. I faced the next problem: After
I'm modelling MySQL database for an website. I'm now making 'people' table, and deciding
My project uses several dll files with activex controls. Now I am making a
I've got legacy code sample which uses JFreeChart and XYPlot. Now i'm making i18n

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.