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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:51:36+00:00 2026-05-19T12:51:36+00:00

I have an app supporting from hdpi to ldpi. It works fine, without any

  • 0

I have an app supporting from hdpi to ldpi. It works fine, without any problem for accessing resources.
In this app, I have a ListView, and I decided to add an image in each view of the list. So I prepared three png images, one for each resolution, and placed them in their respective resource directories.

All is fine with a hdpi 2.2 emulator, but it crashes with a NullPointerException in 2.2 mdpi and ldpi at the bindView method line where I put the drawable in the iImageView:
mImageView.setImageDrawable(getBaseContext().getResources().getDrawable(R.drawable.hello)
I’ve tried to replace getBaseContext() by getApplicationContext() or even removing it without success.

I guess that the app doesn’t look in the -mdpi folder. However, I don’t understand why the hdpi version works fine. Note that there is nothing in the bare drawable directory.
Furthermore, the app knows how to look in these folders since it does it in a previous activity used to launch the one with the ListView.

Any Idea ?

  • 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-19T12:51:37+00:00Added an answer on May 19, 2026 at 12:51 pm

    Perhaps you should replace getBaseContext() with your context. See top answer in this question

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

Sidebar

Related Questions

we have app hosted on google app engine for java. In this app we
We have App A as main app. Now we build from it App B
I have my app working with Sunspot Solr locally, supporting unicode with no issues.
We have an app that we are developing and we are considering supporting two
I have main menu in my app supporting only landscape mode. I implement landscape
Is it possible to have an App (running iOS4 on hardware supporting multi-tasking) which
I have been dropping my sqlite DB in the supporting files of my app
We have developed an app in medium(320x480) and high (480x800) supporting portrait and landscape.
I am in the process of updating an app that is going from supporting
I have a kind of tricky layout in my app, so the main problem

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.