How could a module get the images in Resources/images?--android

You must Login before you can answer or comment on any questions.

I develop an android module and need it to get the image in the Directory:Resource/images,but it could not get the image until now... here is the code to use the method which get images in the module:

WT.sendImage('images/appicon.png');

and this is the method code in the module:

public void sendImage(String path)
    {Bitmap bmp = BitmapFactory.decodeFile(path);
//do sth to the bmp
I always get "bitmap decode failed" here. Is there anything wrong in the directory? It works well with 'images/appicon.png' in IOS. I don't know why? Could some guys give me advice? Thx a lot.

1 Answer

Try this

Bitmap bmp = BitmapFactory.decodeFile(path)
return TiBlob.blobFromImage(bmp)
and return type of sendImage mothod TiBlob

— answered 8 months ago by nilesh kashid
answer permalink
3 Comments
  • sorry that I need to send the image to another app by the module in JAVA,so I need the module could find the directory of the image~I always get the wrong message in DDMS:

    java.io.FileNotFoundException: /images/appicon.png (No such file or directory)
    so bro,could you give me some advice???

    — commented 8 months ago by Youhe Chen

  • So /images/appicon.png is in your application or is in module..... If you want to use appicon of your application then you can find int id for you icon in R.java file which is located at build/gen. Use this id in you module

    — commented 8 months ago by nilesh kashid

  • Hi bro,thanks very much for your help,and appicon.png is just a test image, I may just send the path of a image in application's Resource/images to the module and let the module decode the image and send to another app in JAVA. could I do that?

    — commented 8 months ago by Youhe Chen

Your Answer

This question has been locked and cannot accept new answers.