Android Question no-DPI picture during runtime

Discussion in 'Android Questions' started by peacemaker, Feb 2, 2015.

  1. peacemaker

    peacemaker Well-Known Member 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.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can use XmlLayoutBuilder to load resource files. Though I don't see why you need it. Just load the image and set the ImageView to whichever size you like.
     
  3. peacemaker

    peacemaker Well-Known Member 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 ?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    As I wrote above you can use XmlLayoutBuilder to load standard Android resources.
     
  5. peacemaker

    peacemaker Well-Known Member 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:
    Code:
    Dim Icon As BitmapDrawable
        Icon = Main.AndroidResources1.GetApplicationDrawable(
    "base")
    But cut icon is loaded as
    Code:
    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.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    The drawable resources can only be used with images that are included in the APK file.
     
  7. peacemaker

    peacemaker Well-Known Member Licensed User

    Yes,... so - how to make a marker with a picture as-is, without scaling ? :-(
     
  8. Medexpert

    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
     
  9. DonManfred

    DonManfred Expert Licensed User

    No.

    For any more questions please create a NEW THREAD (each time).

    This is an old thread.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice