Hi

Hi

Can someone please tell me how can I use LL.create image method to create image from URI rather than the actual path. Is it possible? Else please share the alternative approach.

]]>
« (Previous Post)
(Next Post) »

11 Commentsto Hi

  1. Anonymous says:

    < ![CDATA[

    Have you tried Uri.getPath() ?

    ]]>

  2. Anonymous says:

    < ![CDATA[

    And if the Uri is not a path, you will have to copy the data to a file first, using the ContentResolver. 


    LL.getContext().getContentResolver().openInputStream()


    Still, this will not work for all URIs, but the ones that can be handled by the platform for known content providers.

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Hmmm. Uri is not the path. Its in the format android.resource//packagename/drawable/icon_name

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Then you can use this call to directly load the image:


    public Image LL.createImage (packagename, icon_name)



    http://www.pierrox.net/android/applications/lightning_launcher/script/reference/net/pierrox/lightning_launcher/script/api/LL.html#createImage(java.lang.String, java.lang.String)

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Pierre Hébert​ thanks mate. Will this work for icons from mipmap folder too or we have to use icon resource id instead?

    ]]>

  6. Anonymous says:

    < ![CDATA[

    Not sure, LL looks for resource identifiers in the “drawable” category. I don’t know whether mimaps are translated into drawable at build time.

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Pierre Hébert Thanks for you help. Let me try it out and get back to you.


    And Thanks to Lukas Morawietz for your suggestion.

    ]]>

  8. Anonymous says:

    < ![CDATA[

    Pierre Hébert  I tried passing package name, and icon name but with no luck. Its returning only the default android icon without any error. What are the changes if we pass the imageuri into the imageview, get Bitmap from it. Will it be possible to create LL Image from Bitmap. Otherwise i have to go with the OpenInputStreamMethod.

    ]]>

  9. Anonymous says:

    < ![CDATA[

    Strange, if the image cannot be found in resources, it simply returns null. You can find a sample use of this API here: http://www.pierrox.net/android/applications/lightning_launcher/apk_script/Sketch-1.0.tar.gz , maybe it can help to troubleshoot what’s wrong.


    I believe that if you see the Android icon then the problem could be elsewhere: it is displayed when the launcher cannot read the items icon. So maybe it is read correctly from the package resources, but not written correctly over the item’s one.

    ]]>

  10. Anonymous says:

    < ![CDATA[

    Pierre Hébert  Thanks. That worked. My apologies. It was my mistake. Instead of setDefaultIcon, i used setImage. 

    ]]>

  11. Anonymous says:

    < ![CDATA[

    great 🙂

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *