java - Image Resource Gives 0 in Android -


I am developing a small online shopping application for Android which has many items of images, I have a web service The one who gives Android's path to the image in the MD-PDI, my problem here is that I tried this code to get the Image Coder ID, but it always gives me this

  string uri = "@ drawables / bungalows 1 .png"; int imageResource = getResources (). getIdentifier (Yuri, blank, getPackageName ());   

There is no way to get the resource ID, so that I can use it for drawables:

  Drawable res = getResources (). getDrawable (imageResource);   

I tried googling, but most of them suggested the above method and it always gives me 0 values. Anybody please help here

It would be better to get your images in / asset / folder, and not to use drawable resources. Do it. Because Note: Use of this function is frustrating.

If you still want to use your method, try getResources (). GetIdentifier ("bangle1.png", "drawable", getPackageName ());

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -