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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T21:49:41+00:00 2026-05-19T21:49:41+00:00

I have an Android App which contains an external dependend jar library. This external

  • 0

I have an Android App which contains an external dependend jar library. This external library contains some png-bitmaps which I want to show on some ImageViews in my application.

Looking inside the apk file of my application I can find the images in a sub directory (“aq\img”) as expected.

What is the best way to show an image (insight the classpath) on a ImageView.

I tried this

    ImageView imgView01 = (ImageView) findViewById(R.id.imageView1);
    Drawable d = Drawable.createFromPath("aq/img/sample.png");
    imgView01.setImageDrawable(d);

and this

    InputStream is = ClassLoader
            .getSystemResourceAsStream("sample.png");
    Bitmap bm = BitmapFactory.decodeStream(is);
    imgView01.setImageBitmap(bm);

but it did not work (I did not really expect it to be that simple).
The image remains empty.

Thanks for help!

Regards Klaus

  • 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-19T21:49:41+00:00Added an answer on May 19, 2026 at 9:49 pm

    The PNG image is not a “system resource” because a system resource on Android is a file in the regular filesystem. The image that you want is within the APK archive. You would be able to use getSystemResourceAsStream to open an InputStream for reading the bytes of the APK archive, but not a file within the archive unless you implemented the logic to extract the file yourself.

    Simply use this:

    InputStream is = getClass().getClassLoader().getResourceAsStream("aq/img/sample.png");
    

    EDIT: Note that on Android, the name that is passed to getSystemResourceAsStream is treated as a path to the file relative to root (/). Because the APKs are stored in /data/app, then to open an InputStream for reading the APK, you can use ClassLoader.getSystemResourceAsStream("data/app/PACKAGE-1.apk"), where “PACKAGE” is the package of your app.

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

Sidebar

Related Questions

I have created a database for my android app which contains static data and
I have an Android application that generates some HTML which is rendered locally, in
Here's the problem. In my app, I have 5 tabs which contains activities. In
I have a free android app that I want to now distribute as free
I have an Android app which I use to register users on my web
I'm doing some Android development, and I much prefer Visual Studio, but I'll have
I have an Android app with a ListActivity in the main view. The list
I'm developing an Android app (Android 1.6), but this is probably a more general
I am looking to build a button in my Android app which must contain:
I'm working on an android app which would connect to a web server which

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.