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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:12:53+00:00 2026-05-24T19:12:53+00:00

I have a image called(my_image.png) in my Drawable-mdpi folder. my android application interacts with

  • 0

I have a image called(my_image.png) in my Drawable-mdpi folder.

my android application interacts with a webservice. It might send back “my_image”. My android application should load up this image.

I am using Monodroid and I tried this

   int abc = Resources.GetIdentifier("my_image","drawable",null);

Yet the result is always "0". When it should be(from the resource file)

        // aapt resource value: 0x7f020000
        public const int my_image = 2130837504;

Looking around and the android way seems to be similar

int i = this.getResources().getIdentifier("txt_asecondtext", "strings", this.getPackageName());

I tried passing in the package name instead of null but that did nothing.

  • 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-24T19:12:54+00:00Added an answer on May 24, 2026 at 7:12 pm

    The problem is twofold:

    1. You need to provide a package name in the Resources.GetIdentifier() call, and not use null.
    2. You need to use the correct package name.

    The simple way to ensure you get the correct package name is to use the Android.Content.Context.PackageName property:

    int id = Resources.GetIdentifier ("my_image", "drawable", PackageName);
    

    If you don’t want to/can’t use Context.PackageName, then look at the build output, in e.g. the obj\Debug\android\AndroidManifest.xml file, and use the value of the /manifest/@package attribute value. For example, AndroidManifest.xml may contain:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest
            xmlns:android="http://schemas.android.com/apk/res/android" 
            android:versionCode="1"
            android:versionName="1.0"
            package="MonoAndroidApplication2.MonoAndroidApplication2">
        <!-- ... -->
    </manifest>
    

    Thus, you could instead use:

    int id = Resources.GetIdentifier ("my_image", "drawable", 
            "MonoAndroidApplication2.MonoAndroidApplication2");
    

    For monodroid@lists.ximian.com subscribers, see the How to use Resources.GetIdentifier() thread, and the followup message.

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

Sidebar

Related Questions

I have a folder called Etc which has an image I want to use
I have a db.BlobProperty property (called Icon) in my entity which contains an image
I have a view and template called index.html. I have a image which is
I have 2 images inside a folder called Pics..... Image1.jpg and Image2.jpg. What code
I have a png image pic.png and I am making it transparent by using
In my drawable folders i have my icon image, and when testing i use
I have a PHP class that creates a PNG image on the fly and
I have a folder called Images inside my IDE and I want to access
So I have a model called Image that belongs_to :user. Each user has a
I've added an image file (png) to my project. Compiled my application and it

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.