Android Question no-DPI picture during runtime

peacemaker

Expert
Licensed User
How to load bitmaps as from "drawable-nodpi" resource ? During runtime, i.e. any picture got by the app.
To show it over a map as is, without scaling.
 

peacemaker

Expert
Licensed User
Erel, markers on a map (OSM or Google) are (somehow) limited by the bitmap, as i can understand. So no-dpi way is needed. And for any picture, got by the app during runtime.
How to do it ?
 

peacemaker

Expert
Licensed User
But... if i downloaded some picture file - how to load it with full size as the marker ?
1.png 02.png
Picture 1 is OK, as loaded by this code from "drawable-nodpi" folder:
B4X:
    Dim Icon As BitmapDrawable
    Icon = Main.AndroidResources1.GetApplicationDrawable("base")
But cut icon is loaded as
B4X:
    Dim Icon As BitmapDrawable
    Icon.Initialize(LoadBitmap(File.DirAssets, "base.png"))
So task is to load non-cut picture at runtime, as from "drawable-nodpi" folder, but any new picture after download from Internet.
 

peacemaker

Expert
Licensed User
Yes,... so - how to make a marker with a picture as-is, without scaling ? :-(
 

Medexpert

Member
Licensed User
Dear Erel,

I tried your proposal to put the Markers icon to drawable-nodpi folder. Its working well. I can change the icons at runtime what I copied to this folder before the build.

I use Samsung S6 phone with high dpi.
I can not found any solution to use an image file which not build in to apk files. I would like to use image file what I download at runtime. Is it any solution to write the drawable-nodpi folder at runtime? Or any solution for scale the image? I tried to use image file what not in drawable-nodpi folder, but all images was ugly. I tried to resample the image at runtime (with bitmap.InitializeSample )but not helped.

I read about XmlLayoutBuilder what you mentioned, but I do not how can I do it.

Thanks your answer in Advanced,

Istvan
 
Top